1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

è il momento di giocare a worms

This commit is contained in:
Steffo 2018-06-04 13:13:59 +02:00
parent 1df05801af
commit 2b2ddfe4bd
5 changed files with 128 additions and 5 deletions

28
db.py
View file

@ -251,6 +251,34 @@ class RocketLeague(Base):
self.solo_std_rank = None self.solo_std_rank = None
self.solo_std_div = None self.solo_std_div = None
def solo_rank_image(self):
if self.single_rank is None:
rank = 0
else:
rank = self.single_rank
return f"https://rocketleaguestats.com/assets/img/rocket_league/ranked/season_four/{rank}.png"
def doubles_rank_image(self):
if self.doubles_rank is None:
rank = 0
else:
rank = self.doubles_rank
return f"https://rocketleaguestats.com/assets/img/rocket_league/ranked/season_four/{rank}.png"
def standard_rank_image(self):
if self.standard_rank is None:
rank = 0
else:
rank = self.standard_rank
return f"https://rocketleaguestats.com/assets/img/rocket_league/ranked/season_four/{rank}.png"
def solo_std_rank_image(self):
if self.solo_std_rank is None:
rank = 0
else:
rank = self.solo_std_rank
return f"https://rocketleaguestats.com/assets/img/rocket_league/ranked/season_four/{rank}.png"
class Dota(Base): class Dota(Base):
__tablename__ = "dota" __tablename__ = "dota"

View file

@ -38,19 +38,20 @@ input[type="text"], input[type="password"] {
} }
.game-panel { .game-panel {
display: grid;
max-width: 400px; max-width: 400px;
position: relative;
border-radius: 10px;
height: 80px;
} }
.osu { .osu {
display: grid;
position: relative;
font-family: 'Exo 2', 'Helvetica Neue', 'Arial', sans-serif; font-family: 'Exo 2', 'Helvetica Neue', 'Arial', sans-serif;
font-style: italic; font-style: italic;
border: 8px solid #ffffff; border: 8px solid #ffffff;
border-radius: 10px;
color: #ffffff; color: #ffffff;
padding: 10px; padding: 10px;
grid-row-gap: 4px; grid-row-gap: 5px;
.background-image { .background-image {
position: absolute; position: absolute;
@ -129,3 +130,58 @@ input[type="text"], input[type="password"] {
font-size: x-small; font-size: x-small;
} }
} }
.rl {
background-image: linear-gradient(to bottom,rgba(35,91,139,.5),rgba(16,54,84,.5)),
linear-gradient(to right,rgba(35,91,139,.7),rgba(16,54,84,.7));
padding: 18px;
grid-row-gap: 5px;
.player {
grid-row: 1;
grid-column-start: 1;
grid-column-end: 4;
font-size: large;
a {
text-decoration: none;
}
.player-image {
width: 32px;
height: 32px;
vertical-align: middle;
}
.player-name {
vertical-align: middle;
}
}
.game-title {
grid-row: 2;
font-size: smaller;
font-style: normal;
}
.game-score {
grid-row: 3;
}
.duel {
grid-column: 1;
}
.doubles {
grid-column: 2;
}
.standard {
grid-column: 3;
}
.solostd {
grid-column: 4;
}
}

35
templates/minis/rl.html Normal file
View file

@ -0,0 +1,35 @@
<style>
@import url('https://fonts.googleapis.com/css?family=Exo+2');
</style>
<div class="game-panel rl">
<div class="player">
<a href="http://steamcommunity.com/profiles/{{ rl.steam.steam_id }}">
<img src="{{ rl.steam.avatar_url() }}" class="player-image">
<span class="player-name">{{ rl.steam.persona_name }}</span>
</a>
</div>
<div class="game-title duel">
DUELLO
</div>
<div class="game-score duel">
<img src="{{ rl.solo_rank_image() }}">
</div>
<div class="game-title doubles">
DOPPIO
</div>
<div class="game-score doubles">
<img src="{{ rl.doubles_rank_image() }}">
</div>
<div class="game-title standard">
STANDARD
</div>
<div class="game-score standard">
<img src="{{ rl.standard_rank_image() }}">
</div>
<div class="game-title solostd">
SOLO STD
</div>
<div class="game-score solostd">
<img src="{{ rl.solo_std_rank_image() }}">
</div>
</div>

View file

@ -11,4 +11,7 @@
{% if osu %} {% if osu %}
{% include "minis/osu.html" %} {% include "minis/osu.html" %}
{% endif %} {% endif %}
{% if rl %}
{% include "minis/rl.html" %}
{% endif %}
{% endblock %} {% endblock %}

View file

@ -33,7 +33,8 @@ def page_profile(name: str):
abort(404) abort(404)
return return
osu = db_session.query(db.Osu).filter_by(royal=user).one_or_none() osu = db_session.query(db.Osu).filter_by(royal=user).one_or_none()
return render_template("profile.html", royal=user, osu=osu) rl = db_session.query(db.RocketLeague).join(db.Steam).filter_by(royal=user).one_or_none()
return render_template("profile.html", royal=user, osu=osu, rl=rl)
@app.route("/login") @app.route("/login")