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
if state["end_delay"] < 0:
master_games_dic.pop(game_time)
else:
state["end_delay"] -= 1
master_games_dic[game_time][1]["end_delay"] -= 1
else:
this_game.gamestate_update_full()

View File

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

View File

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

View File

@ -614,9 +614,12 @@ async def watch_game(channel, newgame, user = None, league = None):
state_init["is_league"] = False
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):
await channel.send(f"{user_mention}, your game's ready.")
@ -791,8 +794,8 @@ async def game_watcher():
while True:
this_array = gamesarray.copy()
for i in range(0,len(this_array)):
game, channel, user = this_array[i]
if game.over:
game, channel, user, key = this_array[i]
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"
if (game.inning - 1) > game.max_innings: #if extra innings
title_string += f" with {game.inning - (game.max_innings+1)} extra innings."