fixed outs not displaying, fixed game end notification in discord

This commit is contained in:
Sakimori 2021-01-01 12:08:11 -05:00
parent 503a1b7a18
commit acdc160ab0
4 changed files with 12 additions and 6 deletions

View File

@ -111,7 +111,9 @@ def update_loop():
state["update_pause"] = 2 state["update_pause"] = 2
if state["end_delay"] < 0: if state["end_delay"] < 0:
master_games_dic.pop(game_time) master_games_dic.pop(game_time)
state["end_delay"] -= 1 else:
state["end_delay"] -= 1
master_games_dic[game_time][1]["end_delay"] -= 1
else: else:
this_game.gamestate_update_full() this_game.gamestate_update_full()

View File

@ -2,7 +2,7 @@
{% if state.bases[number] %}{{base_filled}}{% else %}{{base_empty}}{% endif %} {% if state.bases[number] %}{{base_filled}}{% else %}{{base_empty}}{% endif %}
{%- endmacro %} {%- endmacro %}
{% macro out(number) -%} {% macro out(number) -%}
{% if number <= state.outs %}{{out_filled}}{% else %}{{out_empty}}{% endif %} {% if number <= state.outs %}{{out_out}}{% else %}{{out_in}}{% endif %}
{%- endmacro %} {%- endmacro %}
<div class="header"> <div class="header">

View File

@ -62,6 +62,7 @@
<Content Include="static\games_page.css" /> <Content Include="static\games_page.css" />
<Content Include="static\loader.js" /> <Content Include="static\loader.js" />
<Content Include="static\prism.png" /> <Content Include="static\prism.png" />
<Content Include="templates\game.html" />
<Content Include="templates\index.html" /> <Content Include="templates\index.html" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -614,9 +614,12 @@ async def watch_game(channel, newgame, user = None, league = None):
state_init["is_league"] = False state_init["is_league"] = False
await channel.send(f"{newgame.teams['away'].name} vs. {newgame.teams['home'].name}, starting at {config()['simmadome_url']}") await channel.send(f"{newgame.teams['away'].name} vs. {newgame.teams['home'].name}, starting at {config()['simmadome_url']}")
gamesarray.append((newgame, channel, user)) timestamp = str(time.time() * 1000.0)
gamesarray.append((newgame, channel, user, timestamp))
main_controller.master_games_dic[str(time.time() * 1000.0)] = (newgame, state_init, discrim_string)
main_controller.master_games_dic[timestamp] = (newgame, state_init, discrim_string)
async def play_from_queue(channel, game, user_mention): async def play_from_queue(channel, game, user_mention):
await channel.send(f"{user_mention}, your game's ready.") await channel.send(f"{user_mention}, your game's ready.")
@ -791,8 +794,8 @@ async def game_watcher():
while True: while True:
this_array = gamesarray.copy() this_array = gamesarray.copy()
for i in range(0,len(this_array)): for i in range(0,len(this_array)):
game, channel, user = this_array[i] game, channel, user, key = this_array[i]
if game.over: if game.over and main_controller.master_games_dic[key][1]["end_delay"] <= 2:
title_string = f"{game.teams['away'].name} at {game.teams['home'].name} ended after {game.inning-1} innings" title_string = f"{game.teams['away'].name} at {game.teams['home'].name} ended after {game.inning-1} innings"
if (game.inning - 1) > game.max_innings: #if extra innings if (game.inning - 1) > game.max_innings: #if extra innings
title_string += f" with {game.inning - (game.max_innings+1)} extra innings." title_string += f" with {game.inning - (game.max_innings+1)} extra innings."