From a549d1d4c61e54d048ba0dba68eff243684186a9 Mon Sep 17 00:00:00 2001 From: Genderdruid Date: Tue, 23 Feb 2021 14:20:55 -0800 Subject: [PATCH 1/8] updated the readme with obl stuff and some missing flags also made some a minor change in the wording of m;oblhelp in matteo for consistency --- README.md | 48 +++++++++++++++++++++++++++++++----------------- the_prestige.py | 2 +- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 462524a..13e3753 100644 --- a/README.md +++ b/README.md @@ -70,9 +70,10 @@ accepting pull requests, check the issues for to-dos. - shows a paginated list of all teams available for games which can be scrolled through. ### game commands: -- m;startgame --day # or -d # +- m;startgame --day # or -d #, -w [weather name] or --weather [weather name] - starts a game with premade teams made using saveteam. provides a link to the website where you can watch the game. - - the --day/-d is optional, if used it'll force the game to use the #th spot in each team's rotations. if this number is larger than the number of pitchers in one or both of the teams' rotations it'll wrap around. if it is not used pitchers will be chosen randomly from the teams' rotations. + - the --day/-d is an optional flag, if used it'll force the game to use the #th spot in each team's rotations. if this number is larger than the number of pitchers in one or both of the teams' rotations it'll wrap around. if it is not used pitchers will be chosen randomly from the teams' rotations. + - the -w/--weather is the same, if used it'll force the game to be the specified weather. - use this command at the top of a list with entries separated by new lines: - the away team's name. - the home team's name. @@ -80,25 +81,24 @@ accepting pull requests, check the issues for to-dos. - this command has fuzzy search so you don't need to type the full name of the team as long as you give enough to identify the team you're looking for. - m;randomgame - starts a 9-inning game between 2 entirely random teams. embrace chaos! -- m;starttournament --rounddelay # - - starts a randomly seeded tournament with the provided teams, automatically adding byes as necessary. all series have a 5 minute break between games. the current format is: best of 5 until the finals which are best of 7. +- m;starttournament --rounddelay #, --bestof #, --finalsbestof # + - starts a randomly seeded tournament with the provided teams, automatically adding byes as necessary. all series have a 5 minute break between games. the current default format is best of 5 until the finals which are best of 7 but this can be adjusted by adding the bestof and finalsbestof flags. - the --rounddelay is optional, if used, # must be between 1 and 120 and it'll set the delay between rounds to be # minutes. if not included it will default to 10. - use this command at the top of a list with entries separated by new lines: - the name of the tournament. - the name of each participating team on its own line. - -### draft commands -- m;startdraft - - starts a draft with an arbitrary number of participants. use this command at the top of a list with entries separated by new lines: - - for each participant's entry you need three lines: - - their discord @ - - their team name - - their team slogan - - post this with all three of these things for all participants and the draft will begin. - - the draft will begin once all participants have given a 👍 and will proceed in the order that participants were entered. each participant will select 12 hitters and 1 pitcher from a pool of 20 random players which will refresh automatically when it becomes small. -- m;draft [name] - - use this on your turn during a draft to pick your player. - - you can also just use a 'd' instead of the full command. + +### obl commands: +- m;oblhelp + - shows the explanation for what the obl is and how to participate. +- m;oblteam [team name] + - displays a team's rank, current OBL points, and current opponent selection. +- m;oblrival [team name] [rival team] + - sets your team's obl rival, this can be changed at any time and requires ownership. your rival is purely cosmetic but will show on your team card and be marked with a special marker if they're on your list of opponents. each team needs to be on a new line below the command. +- m;oblwins [team name] + - displays a trophy case with all teams that the given team has won points off of. +- m;oblstandings + - displays the 15 teams with the most obl points in this meta-season. ### league commands - all of these commands are for leagues that have already been started. to start a league, click the 'create a league' button on the website and fill out the info for your league there, then use the m;claimleague command in discord to set yourself as the owner. @@ -131,6 +131,20 @@ accepting pull requests, check the issues for to-dos. - the currently available starts are: - for batters: avg (batting average), slg (slugging percentage), obp (on-base percentage), ops (on-base plus slugging). - for pitchers era (earned run average), whip (walks and hits per innings pitched), kper9 (strikeouts per 9 innings), bbper9 (walks per 9 innings), kperbb (strikeout to walk ratio). + +### draft commands +- m;startdraft + - starts a draft with an arbitrary number of participants. use this command at the top of a list with entries separated by new lines: + - for each participant's entry you need three lines: + - their discord @ + - their team name + - their team slogan + - post this with all three of these things for all participants and the draft will begin. + - the draft will begin once all participants have given a 👍 and will proceed in the order that participants were entered. each participant will select 12 hitters and 1 pitcher from a pool of 20 random players which will refresh automatically when it becomes small. +- m;draft [name] + - use this on your turn during a draft to pick your player. + - you can also just use a 'd' instead of the full command. + ### player commands: - m;showplayer [name] - displays any name's stars, there's a limit of 70 characters. that should be *plenty*. note: if you want to lookup a lot of different players you can do it on onomancer instead of spamming this command a bunch and clogging up discord: https://onomancer.sibr.dev/reflect diff --git a/the_prestige.py b/the_prestige.py index 6e2467d..819b7fd 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -1241,7 +1241,7 @@ class OBLExplainCommand(Command): async def execute(self, msg, command): await msg.channel.send("""The One Big League, or OBL, is an asynchronous league that includes every team in the simsim's database. To participate, just use the m;oblteam command with your team of choice. **No signup is required!** This will give you a list of five opponents; playing against one of them and winning nets you a point, and will refresh the list with five new opponents. **Losing results in no penalty!** Each meta-season will last for a few weeks, after which the leaderboards are reset to start the race again! -Look out for the people wrestling emoji, which indicates the potential for a :people_wrestling:Wrassle Match:people_wrestling:, where both teams are on each others' lists and both have the opportunity to score a point. Team rankings and points can also be viewed in the oblteam command, and the overall OBL leaderboard can be checked with the m;oblstandings command. Best of luck!! +Look out for the people wrestling emoji, which indicates the potential for a :people_wrestling:Wrassle Match:people_wrestling:, where both teams are on each others' lists and both have the opportunity to score a point. Team rankings and points can also be viewed in the m;oblteam command, and the overall OBL leaderboard can be checked with the m;oblstandings command. Best of luck!! """) class OBLLeaderboardCommand(Command): From 68ab4d1c38a184556ae605d90a1238737e9164e9 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Tue, 23 Feb 2021 18:00:28 -0500 Subject: [PATCH 2/8] bounty board text change --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13e3753..8845f64 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ accepting pull requests, check the issues for to-dos. - m;oblhelp - shows the explanation for what the obl is and how to participate. - m;oblteam [team name] - - displays a team's rank, current OBL points, and current opponent selection. + - displays a team's rank, current OBL points, and current bounty board. - m;oblrival [team name] [rival team] - sets your team's obl rival, this can be changed at any time and requires ownership. your rival is purely cosmetic but will show on your team card and be marked with a special marker if they're on your list of opponents. each team needs to be on a new line below the command. - m;oblwins [team name] From e69240a48101476bd76dff8561ba3420204827ed Mon Sep 17 00:00:00 2001 From: Sakimori Date: Tue, 23 Feb 2021 21:33:50 -0500 Subject: [PATCH 3/8] fixed 201 --- main_controller.py | 4 +++- the_prestige.py | 10 +++++----- weather.py | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/main_controller.py b/main_controller.py index ca693a2..260e634 100644 --- a/main_controller.py +++ b/main_controller.py @@ -186,6 +186,8 @@ def update_loop(): if "weather_message" in this_game.last_update[0].keys(): state["update_emoji"] = this_game.weather.emoji + else: + state["update_emoji"] = "🏏" if "steals" in this_game.last_update[0].keys(): updatestring = "" @@ -211,7 +213,7 @@ def update_loop(): if this_game.last_update[1] > 0: updatestring += f"{this_game.last_update[1]} runs scored!" - state["update_emoji"] = "🏏" + state["update_text"] = updatestring this_game.weather.modify_atbat_message(this_game, state) diff --git a/the_prestige.py b/the_prestige.py index 819b7fd..74ee121 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -1319,11 +1319,11 @@ class OBLSetRivalCommand(Command): elif owner_id != msg.author.id and msg.author.id not in config()["owners"]: await msg.channel.send("You're not authorized to mess with this team. Sorry, boss.") return - #try: - db.set_obl_rival(team, team_r) - await msg.channel.send("One pair of mortal enemies, coming right up. Unless you're more of the 'enemies to lovers' type. We can manage that too, don't worry.") - #except: - #await msg.channel.send("Hm. We don't think that team has tried to do anything in the One Big League yet, so you'll have to wait for consent. Get them to check their bounty board.") + try: + db.set_obl_rival(team, team_r) + await msg.channel.send("One pair of mortal enemies, coming right up. Unless you're more of the 'enemies to lovers' type. We can manage that too, don't worry.") + except: + await msg.channel.send("Hm. We don't think that team has tried to do anything in the One Big League yet, so you'll have to wait for consent. Get them to check their bounty board.") class OBLConqueredCommand(Command): name = "oblwins" diff --git a/weather.py b/weather.py index b4af354..450fc8a 100644 --- a/weather.py +++ b/weather.py @@ -44,7 +44,7 @@ class Supernova(Weather): self.emoji = "🌟" def modify_atbat_stats(self, roll): - roll["pitch_stat"] *= 0.9 + roll["pitch_stat"] *= 0.8 class Midnight(Weather): def __init__(self, game): @@ -73,6 +73,7 @@ class SlightTailwind(Weather): result.clear() result.update({ "text": f"{game.get_batter()} would have gone out, but they took a mulligan!", + "mulligan": True, "text_only": True, "weather_message": True, }) From 392490d70a6d11f256156008642bc2003e61c98a Mon Sep 17 00:00:00 2001 From: Sakimori Date: Tue, 23 Feb 2021 22:14:47 -0500 Subject: [PATCH 4/8] adjusted how breezy affects post-game stats --- games.py | 19 ++++++++++--------- weather.py | 6 +++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/games.py b/games.py index 283edf3..19c49f5 100644 --- a/games.py +++ b/games.py @@ -50,7 +50,8 @@ class player(object): "rbis" : 0, "strikeouts_taken" : 0 } - + self.stat_name = self.name + def star_string(self, key): str_out = "" starstring = str(self.stlats[key]) @@ -670,11 +671,11 @@ class game(object): def get_stats(self): players = [] for this_player in self.teams["away"].lineup: - players.append((this_player.name, this_player.game_stats)) + players.append((this_player.stat_name, this_player.game_stats)) for this_player in self.teams["home"].lineup: - players.append((this_player.name, this_player.game_stats)) - players.append((self.teams["home"].pitcher.name, self.teams["home"].pitcher.game_stats)) - players.append((self.teams["away"].pitcher.name, self.teams["away"].pitcher.game_stats)) + players.append((this_player.stat_name, this_player.game_stats)) + players.append((self.teams["home"].pitcher.stat_name, self.teams["home"].pitcher.game_stats)) + players.append((self.teams["away"].pitcher.stat_name, self.teams["away"].pitcher.game_stats)) return players def get_team_specific_stats(self): @@ -683,11 +684,11 @@ class game(object): self.teams["home"].name : [] } for this_player in self.teams["away"].lineup: - players[self.teams["away"].name].append((this_player.name, this_player.game_stats)) + players[self.teams["away"].name].append((this_player.stat_name, this_player.game_stats)) for this_player in self.teams["home"].lineup: - players[self.teams["home"].name].append((this_player.name, this_player.game_stats)) - players[self.teams["home"].name].append((self.teams["home"].pitcher.name, self.teams["home"].pitcher.game_stats)) - players[self.teams["away"].name].append((self.teams["away"].pitcher.name, self.teams["away"].pitcher.game_stats)) + players[self.teams["home"].name].append((this_player.stat_name, this_player.game_stats)) + players[self.teams["home"].name].append((self.teams["home"].pitcher.stat_name, self.teams["home"].pitcher.game_stats)) + players[self.teams["away"].name].append((self.teams["away"].pitcher.stat_name, self.teams["away"].pitcher.game_stats)) return players diff --git a/weather.py b/weather.py index 450fc8a..a28faff 100644 --- a/weather.py +++ b/weather.py @@ -230,7 +230,7 @@ class Breezy(Weather): def __init__(self, game): self.name = "Breezy" self.emoji = "🎐" - self.activation_chance = 0.05 + self.activation_chance = 0.08 def activate(self, game, result): if random.random() < self.activation_chance: @@ -246,10 +246,10 @@ class Breezy(Weather): names[-1] = first_first_letter + names[-1][1:] player.name = ' '.join(names) else: - #name is one word, so turn 'bartholemew' into 'martholebew' + #name is one word, so turn 'bartholemew' into 'martholemeb' first_letter = player.name[0] last_letter = player.name[-1] - player.name = last_letter + player.name[1:-1] + last_letter + player.name = last_letter + player.name[1:-1] + first_letter book_adjectives = ["action-packed", "historical", "mystery", "thriller", "horror", "sci-fi", "fantasy", "spooky","romantic"] book_types = ["novel", "novella", "poem", "anthology", "fan fiction", "autobiography"] From 851955510f2f13c539cbd3e9db2bf7f10d64212a Mon Sep 17 00:00:00 2001 From: Sakimori Date: Tue, 23 Feb 2021 22:16:24 -0500 Subject: [PATCH 5/8] made breezy change batting and pitching stars of a player --- weather.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/weather.py b/weather.py index a28faff..3ac8bff 100644 --- a/weather.py +++ b/weather.py @@ -237,6 +237,8 @@ class Breezy(Weather): teamtype = random.choice(["away","home"]) team = game.teams[teamtype] player = random.choice(team.lineup) + player.stlats["batting_stars"] = player.stlats["pitching_stars"] + player.stlats["pitching_stars"] = player.stlats["baserunning_stars"] old_player_name = player.name if ' ' in player.name: names = player.name.split(" ") From 999c64cb025ff954b30b01614f1d81ddd6aed57d Mon Sep 17 00:00:00 2001 From: Sakimori Date: Tue, 23 Feb 2021 22:21:32 -0500 Subject: [PATCH 6/8] fixes #202 --- database.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database.py b/database.py index 9bb8e0c..84bdc82 100644 --- a/database.py +++ b/database.py @@ -385,9 +385,9 @@ def save_obl_results(winning_team, losing_team): if re.sub('[^A-Za-z0-9 %]+', '', losing_team.name) in opponent_teams: beaten_teams.append(losing_team.name) try: - opponent_teams = sample(get_filtered_teams([re.sub('[^A-Za-z0-9 %]+', '', winning_team.name)]), 5) + opponent_teams = sample(get_filtered_teams([winning_team.name] + beaten_teams), 5) except ValueError: - opponent_teams = get_filtered_teams([re.sub('[^A-Za-z0-9 %]+', '', winning_team.name)]) + opponent_teams = get_filtered_teams([winning_team.name] + beaten_teams) obl_points += 1 c.execute("UPDATE one_big_league SET teams_beaten_list = ?, current_opponent_pool = ?, obl_points = ? WHERE team_name = ?", (list_to_newline_string(beaten_teams), list_to_newline_string(opponent_teams), obl_points, winning_team.name)) From 5d2afca7ae44c52b0399a810d9948520ae351bbe Mon Sep 17 00:00:00 2001 From: Sakimori Date: Tue, 23 Feb 2021 22:25:28 -0500 Subject: [PATCH 7/8] really fixed #202 --- database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database.py b/database.py index 84bdc82..5c333a3 100644 --- a/database.py +++ b/database.py @@ -324,7 +324,7 @@ def get_filtered_teams(filter_list): teams_list = get_all_team_names() out_list = [] for team in teams_list: - if team not in filter_list: + if re.sub('[^A-Za-z0-9 %]+', '', team) not in filter_list: out_list.append(team) return out_list From fdfea1a273ecaf80fda72e7f41a5f8aa929e15bf Mon Sep 17 00:00:00 2001 From: Sakimori Date: Tue, 23 Feb 2021 22:39:28 -0500 Subject: [PATCH 8/8] *really* fixed #202 --- database.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/database.py b/database.py index 5c333a3..fe563f5 100644 --- a/database.py +++ b/database.py @@ -320,9 +320,10 @@ def get_all_team_names(): conn.close() return None -def get_filtered_teams(filter_list): +def get_filtered_teams(i_filter_list): teams_list = get_all_team_names() out_list = [] + filter_list = [re.sub('[^A-Za-z0-9 %]+', '', filter_team) for filter_team in i_filter_list] for team in teams_list: if re.sub('[^A-Za-z0-9 %]+', '', team) not in filter_list: out_list.append(team)