got leagues up to date with indev

This commit is contained in:
Sakimori 2021-01-03 16:33:45 -05:00
commit 5697c5dbb3
11 changed files with 136 additions and 139 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -1,4 +1,4 @@
import asyncio, time, datetime, games, json, threading, jinja2, leagues import asyncio, time, datetime, games, json, threading, jinja2
from flask import Flask, url_for, Response, render_template, request, jsonify from flask import Flask, url_for, Response, render_template, request, jsonify
from flask_socketio import SocketIO, emit from flask_socketio import SocketIO, emit

View File

@ -1,7 +1,7 @@
@import url('https://fonts.googleapis.com/css2?family=Alegreya&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Alegreya&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Goldman:wght@700&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Goldman:wght@700&display=swap');
body { body {
background-image: url("prism.png"); background-image: url("naturalblack.png");
} }
/* Background pattern from Toptal Subtle Patterns */ /* Background pattern from Toptal Subtle Patterns */
@ -28,6 +28,7 @@ h2 {
.page_header { .page_header {
color: white; color: white;
font-family: 'Goldman', cursive; font-family: 'Goldman', cursive;
text-decoration: none;
} }
#header { #header {
@ -39,8 +40,8 @@ h2 {
align-items: center; align-items: center;
} }
#header > .page_header { #header .page_header {
margin: auto margin: auto;
} }
#link_div { #link_div {

View File

@ -27,33 +27,23 @@
background-color: var(--background-secondary); background-color: var(--background-secondary);
border-top-right-radius: 4px; border-top-right-radius: 4px;
height: max-content; height: max-content;
display: flex;
justify-content: space-between
} }
.inning { .header > div {
float: left; margin: 0.3rem 0.5rem;
margin: 5px;
margin-left: 8px;
}
.weather {
float: right;
margin: 5px;
margin-right: 8px;
} }
.body { .body {
margin: 10px; margin: 0.5rem;
display: grid; display: grid;
grid-template-columns: 66% 33%; grid-template-columns: repeat(3, minmax(0, 1fr));
grid-template-areas: grid-template-areas:
"teams info" "teams teams info" "players players info" "update update update";
"players info" grid-template-rows: 5.5rem auto auto;
"update update"; grid-row-gap: 0.5rem;
grid-template-rows: 90px 85px; grid-column-gap: 0.75rem;
grid-row-gap: 4px;
grid-column-gap: 14px;
flex: 1;
} }
.teams { .teams {
@ -61,14 +51,16 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-around; justify-content: space-around;
margin-right: 12px; min-width: 95%;
max-width: 100%;
width: min-content;
} }
.team { .team {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
width: 100%; width: 100%;
margin: 5px 0px; margin: 0.25rem 0rem;
} }
.team_name { .team_name {
@ -84,8 +76,7 @@
align-items: center; align-items: center;
justify-content: space-around; justify-content: space-around;
background: #4f545c; background: #4f545c;
padding: 25px 0px; padding: 0.75rem 0rem;
margin-right: 10px;
border-radius: 4px; border-radius: 4px;
} }
@ -93,14 +84,14 @@
font-size: 10pt; font-size: 10pt;
text-align: left; text-align: left;
height: max-content; height: max-content;
padding: 5px; margin: 0.3rem 0.5rem;
} }
.leagueoruser { .leagueoruser {
font-size: 10pt; font-size: 10pt;
text-align: right; text-align: right;
height: max-content; height: max-content;
padding: 5px; margin: 0.3rem 0.5rem;
} }
.footer { .footer {
@ -142,17 +133,22 @@
.players { .players {
grid-area: players; grid-area: players;
display: flex; display: grid;
flex-direction: column; grid-template-columns: auto minmax(0, 1fr);
justify-content: space-around; grid-template-rows: auto auto;
align-items: start; grid-column-gap: 0.5rem;
margin-left: 0.3rem;
} }
.player { .players > div {
display: flex; margin: 0.25rem 0rem;
align-items: end; }
width: 100%;
flex-direction: column; .player_type {
text-align: end;
font-weight: bolder;
display: inline-block;
vertical-align: middle;
} }
.player_name { .player_name {
@ -160,16 +156,13 @@
text-overflow: ellipsis; text-overflow: ellipsis;
text-align: start; text-align: start;
white-space: nowrap; white-space: nowrap;
width: 95%; width: 100%;
margin-top: -4px;
} }
.update { .update {
grid-area: update; grid-area: update;
margin-right: 10px; min-height: 3.5rem;
margin-top: 5px; padding: 0rem 0.75rem;
min-height: 50px;
padding: 0px 10px;
height: 100%; height: 100%;
background: var(--background-secondary); background: var(--background-secondary);
border-radius: 4px; border-radius: 4px;
@ -178,14 +171,8 @@
justify-content: start; justify-content: start;
} }
.player_type {
width: 100%;
text-align: start;
font-weight: bolder;
}
.update_emoji { .update_emoji {
margin-right: 10px; margin-right: 0.75rem;
margin-left: 2px; margin-left: 2px;
} }

View File

@ -8,7 +8,7 @@
} }
.container > div { .container > div {
min-height: 325px; min-height: 298px;
} }
#filters { #filters {
@ -21,15 +21,15 @@
} }
#filters > * { #filters > * {
padding: 4px 8px; padding: 0.25rem 0.5rem;
margin: 0px 8px; margin: 0rem 0.5rem;
font-size: 16pt; font-size: 16pt;
background: rgba(0,0,0,0); background: rgba(0,0,0,0);
} }
#filters > .filter { #filters > .filter {
border-radius: 8px; border-radius: 0.5rem;
min-width: 100px; min-width: 6.25rem;
text-align: center; text-align: center;
border: none; border: none;
color: white; color: white;
@ -45,14 +45,14 @@
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
height: 75px; height: 4.5rem;
} }
#footer > div { #footer > div {
text-align: center; text-align: center;
font-size: 20px; font-size: 16pt;
position: relative; position: relative;
top: 5px; top: 0.25rem;
} }
.emptyslot { .emptyslot {

BIN
static/css/naturalblack.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

BIN
static/js/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -23,7 +23,7 @@
<a href="https://github.com/Sakimori/matteo-the-prestige" class="link" target="_blank" rel="noopener noreferrer">Github</a><br /> <a href="https://github.com/Sakimori/matteo-the-prestige" class="link" target="_blank" rel="noopener noreferrer">Github</a><br />
<a href="https://twitter.com/intent/follow?screen_name=SIBR_XVI" class="link" target="_blank" rel="noopener noreferrer">Twitter</a> <a href="https://twitter.com/intent/follow?screen_name=SIBR_XVI" class="link" target="_blank" rel="noopener noreferrer">Twitter</a>
</div> </div>
<h2 class="page_header" style="font-size: 50px;">THE SIMMADOME</h2> <a href="/" class="page_header"><h2 class="page_header" style="font-size: 50px;">THE SIMMADOME</h2></a>
<h2 class="page_header">Join SIBR on <a href="https://discord.gg/UhAajY2NCW" class="link"><img src="static/discord.png" height="30"></a> to start your own games!</h2> <h2 class="page_header">Join SIBR on <a href="https://discord.gg/UhAajY2NCW" class="link"><img src="static/discord.png" height="30"></a> to start your own games!</h2>
</div> </div>
{% block body %}{% endblock %} {% block body %}{% endblock %}

View File

@ -6,6 +6,7 @@ src={% if state.bases[number] %}"/static/img/base_filled.png" alt="{{state.bases
{%- endmacro %} {%- endmacro %}
<div class="header"> <div class="header">
<div class="inning">Inning: {% if state.display_top_of_inning == true %}🔼{% else %}🔽{% endif %} {{ state.display_inning }}/{{ state.max_innings }}</div> <div class="inning">Inning: {% if state.display_top_of_inning == true %}🔼{% else %}🔽{% endif %} {{ state.display_inning }}/{{ state.max_innings }}</div>
<div class="title">{{ state.title }}</div>
<div class="weather">{{ state.weather_emoji }} {{ state.weather_text }}</div> <div class="weather">{{ state.weather_emoji }} {{ state.weather_text }}</div>
</div> </div>
<div class="body"> <div class="body">
@ -36,14 +37,10 @@ src={% if state.bases[number] %}"/static/img/base_filled.png" alt="{{state.bases
</div> </div>
</div> </div>
<div class="players"> <div class="players">
<div class="player pitcher"> <div class="player_type">PITCHER</div>
<div class="player_type">PITCHER</div> <div class="player_name pitcher_name">{{ state.pitcher }}</div>
<div class="player_name pitcher_name">{{ state.pitcher }}</div> <div class="player_type">BATTER</div>
</div> <div class="player_name batter_name">{{ state.batter }}</div>
<div class="player batter">
<div class="player_type">BATTER</div>
<div class="player_name batter_name">{{ state.batter }}</div>
</div>
</div> </div>
<div class="update"> <div class="update">
<div class="update_emoji">{{ state.update_emoji }}</div> <div class="update_emoji">{{ state.update_emoji }}</div>

View File

@ -1,4 +1,4 @@
import discord, json, math, os, roman, games, asyncio, random, main_controller, threading, time, leagues, urllib import discord, json, math, os, roman, games, asyncio, random, main_controller, threading, time, urllib
import database as db import database as db
import onomancer as ono import onomancer as ono
from flask import Flask from flask import Flask
@ -278,50 +278,56 @@ class SwapPlayerCommand(Command):
description = "Swaps a player from lineup to rotation, or from rotation to lineup. Requires team ownership." description = "Swaps a player from lineup to rotation, or from rotation to lineup. Requires team ownership."
async def execute(self, msg, command): async def execute(self, msg, command):
team_name = command.split("\n")[1].strip() try:
player_name = command.split("\n")[2].strip() team_name = command.split("\n")[1].strip()
team, owner_id = games.get_team_and_owner(team_name) player_name = command.split("\n")[2].strip()
if team is None: team, owner_id = games.get_team_and_owner(team_name)
await msg.channel.send("Can't find that team, boss. Typo?") if team is None:
return await msg.channel.send("Can't find that team, boss. Typo?")
elif owner_id != msg.author.id and msg.author.id not in config()["owners"]: return
await msg.channel.send("You're not authorized to mess with this team. Sorry, boss.") elif owner_id != msg.author.id and msg.author.id not in config()["owners"]:
return await msg.channel.send("You're not authorized to mess with this team. Sorry, boss.")
elif not team.swap_player(player_name): return
await msg.channel.send("Either we can't find that player, you've got no space on the other side, or they're your last member of that side of the roster. Can't field an empty lineup, and we *do* have rules, chief.") elif not team.swap_player(player_name):
return await msg.channel.send("Either we can't find that player, you've got no space on the other side, or they're your last member of that side of the roster. Can't field an empty lineup, and we *do* have rules, chief.")
else: return
await msg.channel.send(embed=build_team_embed(team)) else:
games.update_team(team) await msg.channel.send(embed=build_team_embed(team))
await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.") games.update_team(team)
await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.")
except IndexError:
await msg.channel.send("Three lines, remember? Command, then team, then name.")
class MovePlayerCommand(Command): class MovePlayerCommand(Command):
name = "move" name = "moveplayer"
template = """m;move template = """m;moveplayer
[team name] [team name]
[player name] [player name]
[new lineup/rotation position number] (indexed with 1 being the top)""" [new lineup/rotation position number] (indexed with 1 being the top)"""
description = "Moves a player in your lineup or rotation. Requires team ownership." description = "Moves a player in your lineup or rotation. Requires team ownership."
async def execute(self, msg, command): async def execute(self, msg, command):
team_name = command.split("\n")[1].strip()
player_name = command.split("\n")[2].strip()
team, owner_id = games.get_team_and_owner(team_name)
try: try:
new_pos = int(command.split("\n")[3].strip()) team_name = command.split("\n")[1].strip()
except ValueError: player_name = command.split("\n")[2].strip()
await msg.channel.send("Hey, quit being cheeky. We're just trying to help. Third line has to be a natural number, boss.") team, owner_id = games.get_team_and_owner(team_name)
return try:
if owner_id != msg.author.id and msg.author.id not in config()["owners"]: new_pos = int(command.split("\n")[3].strip())
await msg.channel.send("You're not authorized to mess with this team. Sorry, boss.") except ValueError:
return await msg.channel.send("Hey, quit being cheeky. We're just trying to help. Third line has to be a natural number, boss.")
elif not team.slide_player(player_name, new_pos): return
await msg.channel.send("You either gave us a number that was bigger than your current roster, or we couldn't find the player on the team. Try again.") if owner_id != msg.author.id and msg.author.id not in config()["owners"]:
return await msg.channel.send("You're not authorized to mess with this team. Sorry, boss.")
else: return
await msg.channel.send(embed=build_team_embed(team)) elif not team.slide_player(player_name, new_pos):
games.update_team(team) await msg.channel.send("You either gave us a number that was bigger than your current roster, or we couldn't find the player on the team. Try again.")
await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.") return
else:
await msg.channel.send(embed=build_team_embed(team))
games.update_team(team)
await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.")
except IndexError:
await msg.channel.send("Four lines, remember? Command, then team, then name, and finally, new spot on the lineup or rotation.")
class AddPlayerCommand(Command): class AddPlayerCommand(Command):
name = "addplayer" name = "addplayer"
@ -331,50 +337,56 @@ class AddPlayerCommand(Command):
description = "Recruits a new player to your team, as either a pitcher or a batter. Requires team ownership." description = "Recruits a new player to your team, as either a pitcher or a batter. Requires team ownership."
async def execute(self, msg, command): async def execute(self, msg, command):
team_name = command.split("\n")[1].strip() try:
player_name = command.split("\n")[2].strip() team_name = command.split("\n")[1].strip()
team, owner_id = games.get_team_and_owner(team_name) player_name = command.split("\n")[2].strip()
if owner_id != msg.author.id and msg.author.id not in config()["owners"]: team, owner_id = games.get_team_and_owner(team_name)
await msg.channel.send("You're not authorized to mess with this team. Sorry, boss.") if owner_id != msg.author.id and msg.author.id not in config()["owners"]:
return await msg.channel.send("You're not authorized to mess with this team. Sorry, boss.")
new_player = games.player(ono.get_stats(player_name))
if "batter" in command.split("\n")[0]:
if not team.add_lineup(new_player)[0]:
await msg.channel.send("Too many batters 🎶")
return
elif "pitcher" in command.split("\n")[0]:
if not team.add_pitcher(new_player):
await msg.channel.send("8 pitchers is quite enough, we think.")
return return
await msg.channel.send(embed=build_team_embed(team)) new_player = games.player(ono.get_stats(player_name))
games.update_team(team)
await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.")
class DeletePlayerCommand(Command): if "batter" in command.split("\n")[0]:
if not team.add_lineup(new_player)[0]:
await msg.channel.send("Too many batters 🎶")
return
elif "pitcher" in command.split("\n")[0]:
if not team.add_pitcher(new_player):
await msg.channel.send("8 pitchers is quite enough, we think.")
return
await msg.channel.send(embed=build_team_embed(team))
games.update_team(team)
await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.")
except IndexError:
await msg.channel.send("Three lines, remember? Command, then team, then name.")
class RemovePlayerCommand(Command):
name = "removeplayer" name = "removeplayer"
template = """m;removeplayer template = """m;removeplayer
[team name] [team name]
[player name]""" [player name]"""
async def execute(self, msg, command): async def execute(self, msg, command):
team_name = command.split("\n")[1].strip() try:
player_name = command.split("\n")[2].strip() team_name = command.split("\n")[1].strip()
team, owner_id = games.get_team_and_owner(team_name) player_name = command.split("\n")[2].strip()
if owner_id != msg.author.id and msg.author.id not in config()["owners"]: team, owner_id = games.get_team_and_owner(team_name)
await msg.channel.send("You're not authorized to mess with this team. Sorry, boss.") if owner_id != msg.author.id and msg.author.id not in config()["owners"]:
return await msg.channel.send("You're not authorized to mess with this team. Sorry, boss.")
return
if not team.delete_player(player_name): if not team.delete_player(player_name):
await msg.channel.send("We've got bad news: that player isn't on your team. The good news is that... that player isn't on your team?") await msg.channel.send("We've got bad news: that player isn't on your team. The good news is that... that player isn't on your team?")
return return
else: else:
await msg.channel.send(embed=build_team_embed(team)) await msg.channel.send(embed=build_team_embed(team))
games.update_team(team) games.update_team(team)
await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.") await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.")
except IndexError:
await msg.channel.send("Three lines, remember? Command, then team, then name.")
class HelpCommand(Command): class HelpCommand(Command):
@ -467,7 +479,7 @@ commands = [
SwapPlayerCommand(), SwapPlayerCommand(),
MovePlayerCommand(), MovePlayerCommand(),
AddPlayerCommand(), AddPlayerCommand(),
DeletePlayerCommand(), RemovePlayerCommand(),
DeleteTeamCommand(), DeleteTeamCommand(),
ShowTeamCommand(), ShowTeamCommand(),
ShowAllTeamsCommand(), ShowAllTeamsCommand(),