Merge pull request #252 from Sakimori/return-bugfixes
fixed lots of bugg
This commit is contained in:
commit
ca8e1d44fc
4
games.py
4
games.py
|
@ -550,7 +550,7 @@ class game(object):
|
||||||
else:
|
else:
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
self.voice.activate(self.last_update[0], result, self)
|
result = self.voice.activate(self.last_update[0], result, self)
|
||||||
|
|
||||||
if "twopart" not in result:
|
if "twopart" not in result:
|
||||||
self.weather.activate(self, result) # possibly modify result in-place
|
self.weather.activate(self, result) # possibly modify result in-place
|
||||||
|
@ -690,7 +690,7 @@ class game(object):
|
||||||
self.inning += 1
|
self.inning += 1
|
||||||
if self.inning > self.max_innings and self.teams["home"].score != self.teams["away"].score: #game over
|
if self.inning > self.max_innings and self.teams["home"].score != self.teams["away"].score: #game over
|
||||||
self.over = True
|
self.over = True
|
||||||
if self.max_innings >= 9:
|
if self.max_innings >= 9 or self.weather.name in ["Leaf Eddies", "Torrential Downpour"]:
|
||||||
if self.teams["home"].score == 16:
|
if self.teams["home"].score == 16:
|
||||||
this_xvi_team = self.teams["home"]
|
this_xvi_team = self.teams["home"]
|
||||||
elif self.teams["away"].score == 16:
|
elif self.teams["away"].score == 16:
|
||||||
|
|
20
gametext.py
20
gametext.py
|
@ -45,7 +45,7 @@ class game_strings_base(object):
|
||||||
|
|
||||||
twoparts = []
|
twoparts = []
|
||||||
|
|
||||||
diff_formats = {fielderschoice[0]: ("defender", "base_string"),
|
diff_formats = {fielderschoice[0]: ("batter", "base_string"),
|
||||||
steal_success[0]: ("runner", "base_string"),
|
steal_success[0]: ("runner", "base_string"),
|
||||||
steal_caught[0]: ("runner", "base_string", "defender")}
|
steal_caught[0]: ("runner", "base_string", "defender")}
|
||||||
no_formats = strikeoutlooking + strikeoutswinging + doubleplay + walk + single + double + triple + homerun + grandslam
|
no_formats = strikeoutlooking + strikeoutswinging + doubleplay + walk + single + double + triple + homerun + grandslam
|
||||||
|
@ -66,6 +66,7 @@ class game_strings_base(object):
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
currentupdate["displaytext"] = f"{currentupdate['batter']} {self.format_gamestring(getattr(self, currentupdate['outcome'].name)[currentupdate['voiceindex']], currentupdate)}"
|
currentupdate["displaytext"] = f"{currentupdate['batter']} {self.format_gamestring(getattr(self, currentupdate['outcome'].name)[currentupdate['voiceindex']], currentupdate)}"
|
||||||
|
return currentupdate
|
||||||
except:
|
except:
|
||||||
game_strings_base().activate(lastupdate, currentupdate, game)
|
game_strings_base().activate(lastupdate, currentupdate, game)
|
||||||
|
|
||||||
|
@ -285,15 +286,15 @@ class TheNewGuy(game_strings_base):
|
||||||
"whacks the ball onto the ground reeeally far away. {} gets to it eventually, but not in time to stop ANYONE from making it home!!",
|
"whacks the ball onto the ground reeeally far away. {} gets to it eventually, but not in time to stop ANYONE from making it home!!",
|
||||||
"hits a quadruple home run!"]
|
"hits a quadruple home run!"]
|
||||||
|
|
||||||
steal_success = ["runs to the next base too early!! You can do that??",
|
steal_success = ["{} runs to the next base too early!! You can do that??",
|
||||||
"is cheating!! They just ran to the next base and nobody even hit the ball!",
|
"{} is cheating!! They just ran to the next base and nobody even hit the ball!",
|
||||||
"gets bored of waiting and takes off, narrowly making it to the next base!"]
|
"{} gets bored of waiting and takes off, narrowly making it to the next base!"]
|
||||||
|
|
||||||
steal_caught = ["tries to run to the next base too early, and gets caught cheating!",
|
steal_caught = ["{} tries to run to the next base too early, and gets caught cheating!",
|
||||||
"sees if they can get away with dashing over to the next base. They can’t, turns out.",
|
"{} sees if they can get away with dashing over to the next base. They can’t, turns out.",
|
||||||
"tries running to the next base, but {}’s ready for them. Out!"]
|
"{} tries running to the next base, but {}’s ready for them. Out!"]
|
||||||
|
|
||||||
no_formats = strikeoutlooking + strikeoutswinging + walk + double + triple + steal_success + steal_caught[:2] + [flyout[2][0], flyout[4][0], fielderschoice[1][0], single[0][1], single[1], walk[1][0], walk[1][1],
|
no_formats = strikeoutlooking + strikeoutswinging + walk + double + triple + [flyout[2][0], flyout[4][0], fielderschoice[1][0], single[0][1], single[1], walk[1][0], walk[1][1],
|
||||||
homerun[0], homerun[1][0], homerun[1][1], homerun[2], grandslam[0], grandslam[2]]
|
homerun[0], homerun[1][0], homerun[1][1], homerun[2], grandslam[0], grandslam[2]]
|
||||||
|
|
||||||
diff_formats = {groundout[2]: ("defender", "batter"), groundout[3]: ("defender", "batter"),
|
diff_formats = {groundout[2]: ("defender", "batter"), groundout[3]: ("defender", "batter"),
|
||||||
|
@ -302,7 +303,8 @@ class TheNewGuy(game_strings_base):
|
||||||
doubleplay[0][1]: ("batter",),
|
doubleplay[0][1]: ("batter",),
|
||||||
sacrifice[0][1]: ("runner",), sacrifice[1]: ("defender", "runner"),
|
sacrifice[0][1]: ("runner",), sacrifice[1]: ("defender", "runner"),
|
||||||
single[2]: ("batter",),
|
single[2]: ("batter",),
|
||||||
steal_caught[2]: ("defender",)}
|
steal_success[0]: ("runner",), steal_success[1]: ("runner",), steal_success[2]: ("runner",),
|
||||||
|
steal_caught[0]: ("runner",), steal_caught[1]: ("runner",), steal_caught[2]: ("runner", "defender")}
|
||||||
|
|
||||||
twoparts = [flyout[0], flyout[2], flyout[4], doubleplay[0], sacrifice[0], walk[1], single[0], homerun[1]]
|
twoparts = [flyout[0], flyout[2], flyout[4], doubleplay[0], sacrifice[0], walk[1], single[0], homerun[1]]
|
||||||
|
|
||||||
|
|
|
@ -256,4 +256,4 @@ def update_loop():
|
||||||
socket_thread = threading.Thread(target=socketio.emit, args=("states_update", game_states))
|
socket_thread = threading.Thread(target=socketio.emit, args=("states_update", game_states))
|
||||||
socket_thread.start()
|
socket_thread.start()
|
||||||
#socketio.emit("states_update", game_states)
|
#socketio.emit("states_update", game_states)
|
||||||
time.sleep(3)
|
time.sleep(8)
|
|
@ -147,7 +147,7 @@ class StartGameCommand(Command):
|
||||||
weather_name = flag[1]
|
weather_name = flag[1]
|
||||||
if weather_name not in weather.all_weathers():
|
if weather_name not in weather.all_weathers():
|
||||||
raise CommandError("We can't find that weather, chief. Try again.")
|
raise CommandError("We can't find that weather, chief. Try again.")
|
||||||
elif flag[0] == "v":
|
elif flag[0] == "v" or flag[0] == "a":
|
||||||
if flag[1] in gametext.all_voices():
|
if flag[1] in gametext.all_voices():
|
||||||
voice = gametext.all_voices()[flag[1]]
|
voice = gametext.all_voices()[flag[1]]
|
||||||
else:
|
else:
|
||||||
|
@ -545,6 +545,8 @@ class StartTournamentCommand(Command):
|
||||||
rand_seed = True
|
rand_seed = True
|
||||||
pre_seeded = False
|
pre_seeded = False
|
||||||
|
|
||||||
|
list_of_team_names = command.split("\n")[2:]
|
||||||
|
|
||||||
if config()["game_freeze"]:
|
if config()["game_freeze"]:
|
||||||
raise CommandError("Patch incoming. We're not allowing new games right now.")
|
raise CommandError("Patch incoming. We're not allowing new games right now.")
|
||||||
|
|
||||||
|
@ -565,6 +567,8 @@ class StartTournamentCommand(Command):
|
||||||
raise CommandError("Series length has to be an odd positive integer.")
|
raise CommandError("Series length has to be an odd positive integer.")
|
||||||
if msg.author.id not in config()["owners"] and series_length > 21:
|
if msg.author.id not in config()["owners"] and series_length > 21:
|
||||||
raise CommandError("That's too long, boss. We have to run patches *some* time.")
|
raise CommandError("That's too long, boss. We have to run patches *some* time.")
|
||||||
|
if len(list_of_team_names) == 2:
|
||||||
|
raise CommandError("--bestof is only for non-finals matches! You probably want --finalsbestof, boss. -f works too, if you want to pay respects.")
|
||||||
elif flag[0] == "f": #pay respects (finalsbestof)
|
elif flag[0] == "f": #pay respects (finalsbestof)
|
||||||
try:
|
try:
|
||||||
finals_series_length = int(flag[1])
|
finals_series_length = int(flag[1])
|
||||||
|
@ -588,7 +592,6 @@ class StartTournamentCommand(Command):
|
||||||
raise CommandError("One or more of those flags wasn't right. Try and fix that for us and we'll see about sorting you out.")
|
raise CommandError("One or more of those flags wasn't right. Try and fix that for us and we'll see about sorting you out.")
|
||||||
|
|
||||||
tourney_name = command.split("\n")[1]
|
tourney_name = command.split("\n")[1]
|
||||||
list_of_team_names = command.split("\n")[2:]
|
|
||||||
team_dic = {}
|
team_dic = {}
|
||||||
for name in list_of_team_names:
|
for name in list_of_team_names:
|
||||||
team = get_team_fuzzy_search(name.strip())
|
team = get_team_fuzzy_search(name.strip())
|
||||||
|
@ -1623,7 +1626,10 @@ async def on_message(msg):
|
||||||
flags.append((flag.split(" ")[0][0].lower(), flag.split(" ",1)[1].strip()))
|
flags.append((flag.split(" ")[0][0].lower(), flag.split(" ",1)[1].strip()))
|
||||||
except IndexError:
|
except IndexError:
|
||||||
flags.append((flag.split(" ")[0][0].lower(), None))
|
flags.append((flag.split(" ")[0][0].lower(), None))
|
||||||
await comm.execute(msg, send_text, flags)
|
|
||||||
|
if comm.isauthorized(msg.author): #only execute command if authorized
|
||||||
|
await comm.execute(msg, send_text, flags)
|
||||||
|
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
await msg.channel.send("Can't find that command, boss; try checking the list with `m;help`.")
|
await msg.channel.send("Can't find that command, boss; try checking the list with `m;help`.")
|
||||||
except CommandError as ce:
|
except CommandError as ce:
|
||||||
|
@ -2419,6 +2425,9 @@ async def league_day_watcher(channel, league, games_list, filter_url, last = Fal
|
||||||
next_start = (now + delta).replace(second=0, microsecond=0)
|
next_start = (now + delta).replace(second=0, microsecond=0)
|
||||||
wait_seconds = (next_start - now).seconds
|
wait_seconds = (next_start - now).seconds
|
||||||
|
|
||||||
|
if wait_seconds > 3601: #there's never a situation to wait longer than an hour so hoo ray bugfixes the easy way
|
||||||
|
wait_seconds = 60
|
||||||
|
|
||||||
leagues.save_league(league)
|
leagues.save_league(league)
|
||||||
active_standings[league] = await channel.send(embed=league.standings_embed())
|
active_standings[league] = await channel.send(embed=league.standings_embed())
|
||||||
await league_subscriber_update(league, channel, f"The day {league.day} games for the {league.name} will start in {math.ceil(wait_seconds/60)} minutes.")
|
await league_subscriber_update(league, channel, f"The day {league.day} games for the {league.name} will start in {math.ceil(wait_seconds/60)} minutes.")
|
||||||
|
|
Loading…
Reference in a new issue