Merge branch 'indev' of https://github.com/Sakimori/matteo-the-prestige into indev
This commit is contained in:
commit
4b0932427f
8
games.py
8
games.py
|
@ -108,6 +108,14 @@ class team(object):
|
|||
else:
|
||||
return (None, None, None)
|
||||
|
||||
def average_stars(self):
|
||||
total_stars = 0
|
||||
for _player in self.lineup:
|
||||
total_stars += _player.stlats["batting_stars"]
|
||||
for _player in self.rotation:
|
||||
total_stars += _player.stlats["pitching_stars"]
|
||||
return total_stars/(len(self.lineup) + len(self.rotation))
|
||||
|
||||
def swap_player(self, name):
|
||||
this_player, index, roster = self.find_player(name)
|
||||
if this_player is not None and len(roster) > 1:
|
||||
|
|
19
leagues.py
19
leagues.py
|
@ -1,19 +0,0 @@
|
|||
import time, asyncio, jsonpickle
|
||||
import database as db
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class league(object):
|
||||
def __init__(self, name, subleagues_dic):
|
||||
self.subleagues = {} #key: name, value: [divisions]
|
||||
self.max_days
|
||||
self.day = 1
|
||||
self.name = name
|
||||
self.subleagues = subleagues_dic
|
||||
|
||||
class division(object):
|
||||
def __init__(self):
|
||||
self.teams = {} #key: team name, value: {wins; losses; run diff}
|
||||
|
|
@ -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_socketio import SocketIO, emit
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
@import url('https://fonts.googleapis.com/css2?family=Alegreya&display=swap');
|
||||
@import url('https://fonts.googleapis.com/css2?family=Goldman:wght@700&display=swap');
|
||||
body {
|
||||
background-image: url("prism.png");
|
||||
background-image: url("naturalblack.png");
|
||||
}
|
||||
/* Background pattern from Toptal Subtle Patterns */
|
||||
|
||||
|
@ -28,6 +28,7 @@ h2 {
|
|||
.page_header {
|
||||
color: white;
|
||||
font-family: 'Goldman', cursive;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#header {
|
||||
|
@ -39,8 +40,8 @@ h2 {
|
|||
align-items: center;
|
||||
}
|
||||
|
||||
#header > .page_header {
|
||||
margin: auto
|
||||
#header .page_header {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#link_div {
|
||||
|
|
|
@ -27,33 +27,23 @@
|
|||
background-color: var(--background-secondary);
|
||||
border-top-right-radius: 4px;
|
||||
height: max-content;
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between
|
||||
}
|
||||
|
||||
.inning {
|
||||
float: left;
|
||||
margin: 5px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.weather {
|
||||
float: right;
|
||||
margin: 5px;
|
||||
margin-right: 8px;
|
||||
.header > div {
|
||||
margin: 0.3rem 0.5rem;
|
||||
}
|
||||
|
||||
.body {
|
||||
margin: 10px;
|
||||
margin: 0.5rem;
|
||||
display: grid;
|
||||
grid-template-columns: 66% 33%;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
grid-template-areas:
|
||||
"teams info"
|
||||
"players info"
|
||||
"update update";
|
||||
grid-template-rows: 90px 85px;
|
||||
grid-row-gap: 4px;
|
||||
grid-column-gap: 14px;
|
||||
flex: 1;
|
||||
"teams teams info" "players players info" "update update update";
|
||||
grid-template-rows: 5.5rem auto auto;
|
||||
grid-row-gap: 0.5rem;
|
||||
grid-column-gap: 0.75rem;
|
||||
}
|
||||
|
||||
.teams {
|
||||
|
@ -61,14 +51,16 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
margin-right: 12px;
|
||||
min-width: 95%;
|
||||
max-width: 100%;
|
||||
width: min-content;
|
||||
}
|
||||
|
||||
.team {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
margin: 5px 0px;
|
||||
margin: 0.25rem 0rem;
|
||||
}
|
||||
|
||||
.team_name {
|
||||
|
@ -84,8 +76,7 @@
|
|||
align-items: center;
|
||||
justify-content: space-around;
|
||||
background: #4f545c;
|
||||
padding: 25px 0px;
|
||||
margin-right: 10px;
|
||||
padding: 0.75rem 0rem;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
|
@ -93,14 +84,14 @@
|
|||
font-size: 10pt;
|
||||
text-align: left;
|
||||
height: max-content;
|
||||
padding: 5px;
|
||||
margin: 0.3rem 0.5rem;
|
||||
}
|
||||
|
||||
.leagueoruser {
|
||||
font-size: 10pt;
|
||||
text-align: right;
|
||||
height: max-content;
|
||||
padding: 5px;
|
||||
margin: 0.3rem 0.5rem;
|
||||
}
|
||||
|
||||
.footer {
|
||||
|
@ -142,17 +133,22 @@
|
|||
|
||||
.players {
|
||||
grid-area: players;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
align-items: start;
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
grid-template-rows: auto auto;
|
||||
grid-column-gap: 0.5rem;
|
||||
margin-left: 0.3rem;
|
||||
}
|
||||
|
||||
.player {
|
||||
display: flex;
|
||||
align-items: end;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
.players > div {
|
||||
margin: 0.25rem 0rem;
|
||||
}
|
||||
|
||||
.player_type {
|
||||
text-align: end;
|
||||
font-weight: bolder;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.player_name {
|
||||
|
@ -160,16 +156,13 @@
|
|||
text-overflow: ellipsis;
|
||||
text-align: start;
|
||||
white-space: nowrap;
|
||||
width: 95%;
|
||||
margin-top: -4px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.update {
|
||||
grid-area: update;
|
||||
margin-right: 10px;
|
||||
margin-top: 5px;
|
||||
min-height: 50px;
|
||||
padding: 0px 10px;
|
||||
min-height: 3.5rem;
|
||||
padding: 0rem 0.75rem;
|
||||
height: 100%;
|
||||
background: var(--background-secondary);
|
||||
border-radius: 4px;
|
||||
|
@ -178,14 +171,8 @@
|
|||
justify-content: start;
|
||||
}
|
||||
|
||||
.player_type {
|
||||
width: 100%;
|
||||
text-align: start;
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.update_emoji {
|
||||
margin-right: 10px;
|
||||
margin-right: 0.75rem;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
}
|
||||
|
||||
.container > div {
|
||||
min-height: 325px;
|
||||
min-height: 298px;
|
||||
}
|
||||
|
||||
#filters {
|
||||
|
@ -21,15 +21,15 @@
|
|||
}
|
||||
|
||||
#filters > * {
|
||||
padding: 4px 8px;
|
||||
margin: 0px 8px;
|
||||
padding: 0.25rem 0.5rem;
|
||||
margin: 0rem 0.5rem;
|
||||
font-size: 16pt;
|
||||
background: rgba(0,0,0,0);
|
||||
}
|
||||
|
||||
#filters > .filter {
|
||||
border-radius: 8px;
|
||||
min-width: 100px;
|
||||
border-radius: 0.5rem;
|
||||
min-width: 6.25rem;
|
||||
text-align: center;
|
||||
border: none;
|
||||
color: white;
|
||||
|
@ -45,14 +45,14 @@
|
|||
flex-direction: column;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 75px;
|
||||
height: 4.5rem;
|
||||
}
|
||||
|
||||
#footer > div {
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
font-size: 16pt;
|
||||
position: relative;
|
||||
top: 5px;
|
||||
top: 0.25rem;
|
||||
}
|
||||
|
||||
.emptyslot {
|
||||
|
|
BIN
static/css/naturalblack.png
Normal file
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
BIN
static/js/.DS_Store
vendored
Normal file
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB |
|
@ -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://twitter.com/intent/follow?screen_name=SIBR_XVI" class="link" target="_blank" rel="noopener noreferrer">Twitter</a>
|
||||
</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>
|
||||
</div>
|
||||
{% block body %}{% endblock %}
|
||||
|
|
|
@ -6,6 +6,7 @@ src={% if state.bases[number] %}"/static/img/base_filled.png" alt="{{state.bases
|
|||
{%- endmacro %}
|
||||
<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="title">{{ state.title }}</div>
|
||||
<div class="weather">{{ state.weather_emoji }} {{ state.weather_text }}</div>
|
||||
</div>
|
||||
<div class="body">
|
||||
|
@ -36,15 +37,11 @@ src={% if state.bases[number] %}"/static/img/base_filled.png" alt="{{state.bases
|
|||
</div>
|
||||
</div>
|
||||
<div class="players">
|
||||
<div class="player pitcher">
|
||||
<div class="player_type">PITCHER</div>
|
||||
<div class="player_name pitcher_name">{{ state.pitcher }}</div>
|
||||
</div>
|
||||
<div class="player batter">
|
||||
<div class="player_type">BATTER</div>
|
||||
<div class="player_name batter_name">{{ state.batter }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="update">
|
||||
<div class="update_emoji">{{ state.update_emoji }}</div>
|
||||
<div class="update_text">{{ state.update_text }}</div>
|
||||
|
|
|
@ -29,9 +29,6 @@
|
|||
<Compile Include="debug storage.py">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="leagues.py">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="main_controller.py">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
@ -60,16 +57,28 @@
|
|||
<Content Include="games_config.json" />
|
||||
<Content Include="ids" />
|
||||
<Content Include="matteo.db" />
|
||||
<Content Include="static\css\common.css" />
|
||||
<Content Include="static\css\game.css" />
|
||||
<Content Include="static\css\games_page.css" />
|
||||
<Content Include="static\css\game_page.css" />
|
||||
<Content Include="static\css\prism.png" />
|
||||
<Content Include="static\discord.png" />
|
||||
<Content Include="static\game.html" />
|
||||
<Content Include="static\games_page.css" />
|
||||
<Content Include="static\loader.js" />
|
||||
<Content Include="static\prism.png" />
|
||||
<Content Include="static\img\base_empty.png" />
|
||||
<Content Include="static\img\base_filled.png" />
|
||||
<Content Include="static\img\out_in.png" />
|
||||
<Content Include="static\img\out_out.png" />
|
||||
<Content Include="static\js\game_loader.js" />
|
||||
<Content Include="static\js\grid_loader.js" />
|
||||
<Content Include="templates\base.html" />
|
||||
<Content Include="templates\game.html" />
|
||||
<Content Include="templates\game_box.html" />
|
||||
<Content Include="templates\index.html" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="static\" />
|
||||
<Folder Include="static\css\" />
|
||||
<Folder Include="static\img\" />
|
||||
<Folder Include="static\js\" />
|
||||
<Folder Include="templates\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
|
||||
|
|
|
@ -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 onomancer as ono
|
||||
from flask import Flask
|
||||
|
@ -302,6 +302,7 @@ class SwapPlayerCommand(Command):
|
|||
description = "Swaps a player from lineup to rotation, or from rotation to lineup. Requires team ownership."
|
||||
|
||||
async def execute(self, msg, command):
|
||||
try:
|
||||
team_name = command.split("\n")[1].strip()
|
||||
player_name = command.split("\n")[2].strip()
|
||||
team, owner_id = games.get_team_and_owner(team_name)
|
||||
|
@ -318,6 +319,8 @@ class SwapPlayerCommand(Command):
|
|||
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 MovePlayerCommand(Command):
|
||||
name = "move"
|
||||
|
@ -328,6 +331,7 @@ class MovePlayerCommand(Command):
|
|||
description = "Moves a player in your lineup or rotation. Requires team ownership."
|
||||
|
||||
async def execute(self, msg, command):
|
||||
try:
|
||||
team_name = command.split("\n")[1].strip()
|
||||
player_name = command.split("\n")[2].strip()
|
||||
team, owner_id = games.get_team_and_owner(team_name)
|
||||
|
@ -346,6 +350,8 @@ class MovePlayerCommand(Command):
|
|||
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):
|
||||
name = "addplayer"
|
||||
|
@ -355,6 +361,7 @@ class AddPlayerCommand(Command):
|
|||
description = "Recruits a new player to your team, as either a pitcher or a batter. Requires team ownership."
|
||||
|
||||
async def execute(self, msg, command):
|
||||
try:
|
||||
team_name = command.split("\n")[1].strip()
|
||||
player_name = command.split("\n")[2].strip()
|
||||
team, owner_id = games.get_team_and_owner(team_name)
|
||||
|
@ -376,6 +383,8 @@ class AddPlayerCommand(Command):
|
|||
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 DeletePlayerCommand(Command):
|
||||
name = "removeplayer"
|
||||
|
@ -384,6 +393,7 @@ class DeletePlayerCommand(Command):
|
|||
[player name]"""
|
||||
|
||||
async def execute(self, msg, command):
|
||||
try:
|
||||
team_name = command.split("\n")[1].strip()
|
||||
player_name = command.split("\n")[2].strip()
|
||||
team, owner_id = games.get_team_and_owner(team_name)
|
||||
|
@ -399,6 +409,8 @@ class DeletePlayerCommand(Command):
|
|||
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 HelpCommand(Command):
|
||||
|
|
Loading…
Reference in New Issue
Block a user