mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
sssh
This commit is contained in:
parent
d2449f6cf7
commit
2c467ba2b7
7 changed files with 141 additions and 56 deletions
42
db.py
42
db.py
|
@ -904,31 +904,31 @@ class Halloween(Base):
|
|||
|
||||
def pieces_completed(self) -> int:
|
||||
count = 0
|
||||
if puzzle_piece_a is not None:
|
||||
if self.puzzle_piece_a is not None:
|
||||
count += 1
|
||||
if puzzle_piece_b is not None:
|
||||
if self.puzzle_piece_b is not None:
|
||||
count += 1
|
||||
if puzzle_piece_c is not None:
|
||||
if self.puzzle_piece_c is not None:
|
||||
count += 1
|
||||
if puzzle_piece_d is not None:
|
||||
if self.puzzle_piece_d is not None:
|
||||
count += 1
|
||||
if puzzle_piece_e is not None:
|
||||
if self.puzzle_piece_e is not None:
|
||||
count += 1
|
||||
if puzzle_piece_f is not None:
|
||||
if self.puzzle_piece_f is not None:
|
||||
count += 1
|
||||
if puzzle_piece_g is not None:
|
||||
if self.puzzle_piece_g is not None:
|
||||
count += 1
|
||||
if puzzle_piece_h is not None:
|
||||
if self.puzzle_piece_h is not None:
|
||||
count += 1
|
||||
if puzzle_piece_i is not None:
|
||||
if self.puzzle_piece_i is not None:
|
||||
count += 1
|
||||
if puzzle_piece_j is not None:
|
||||
if self.puzzle_piece_j is not None:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
@staticmethod
|
||||
def puzzle_is_complete() -> bool:
|
||||
session = db.Session()
|
||||
session = Session()
|
||||
halloweens = session.query(Halloween).all()
|
||||
session.close()
|
||||
completed_a = False
|
||||
|
@ -969,7 +969,7 @@ class Halloween(Base):
|
|||
|
||||
@staticmethod
|
||||
def puzzle_piece_a_complete() -> bool:
|
||||
session = db.Session()
|
||||
session = Session()
|
||||
halloweens = session.query(Halloween).all()
|
||||
session.close()
|
||||
for halloween in halloweens:
|
||||
|
@ -979,7 +979,7 @@ class Halloween(Base):
|
|||
|
||||
@staticmethod
|
||||
def puzzle_piece_b_complete() -> bool:
|
||||
session = db.Session()
|
||||
session = Session()
|
||||
halloweens = session.query(Halloween).all()
|
||||
session.close()
|
||||
for halloween in halloweens:
|
||||
|
@ -989,7 +989,7 @@ class Halloween(Base):
|
|||
|
||||
@staticmethod
|
||||
def puzzle_piece_c_complete() -> bool:
|
||||
session = db.Session()
|
||||
session = Session()
|
||||
halloweens = session.query(Halloween).all()
|
||||
session.close()
|
||||
for halloween in halloweens:
|
||||
|
@ -1000,7 +1000,7 @@ class Halloween(Base):
|
|||
|
||||
@staticmethod
|
||||
def puzzle_piece_d_complete() -> bool:
|
||||
session = db.Session()
|
||||
session = Session()
|
||||
halloweens = session.query(Halloween).all()
|
||||
session.close()
|
||||
for halloween in halloweens:
|
||||
|
@ -1010,7 +1010,7 @@ class Halloween(Base):
|
|||
|
||||
@staticmethod
|
||||
def puzzle_piece_e_complete() -> bool:
|
||||
session = db.Session()
|
||||
session = Session()
|
||||
halloweens = session.query(Halloween).all()
|
||||
session.close()
|
||||
for halloween in halloweens:
|
||||
|
@ -1020,7 +1020,7 @@ class Halloween(Base):
|
|||
|
||||
@staticmethod
|
||||
def puzzle_piece_f_complete() -> bool:
|
||||
session = db.Session()
|
||||
session = Session()
|
||||
halloweens = session.query(Halloween).all()
|
||||
session.close()
|
||||
for halloween in halloweens:
|
||||
|
@ -1030,7 +1030,7 @@ class Halloween(Base):
|
|||
|
||||
@staticmethod
|
||||
def puzzle_piece_g_complete() -> bool:
|
||||
session = db.Session()
|
||||
session = Session()
|
||||
halloweens = session.query(Halloween).all()
|
||||
session.close()
|
||||
for halloween in halloweens:
|
||||
|
@ -1040,7 +1040,7 @@ class Halloween(Base):
|
|||
|
||||
@staticmethod
|
||||
def puzzle_piece_h_complete() -> bool:
|
||||
session = db.Session()
|
||||
session = Session()
|
||||
halloweens = session.query(Halloween).all()
|
||||
session.close()
|
||||
for halloween in halloweens:
|
||||
|
@ -1050,7 +1050,7 @@ class Halloween(Base):
|
|||
|
||||
@staticmethod
|
||||
def puzzle_piece_i_complete() -> bool:
|
||||
session = db.Session()
|
||||
session = Session()
|
||||
halloweens = session.query(Halloween).all()
|
||||
session.close()
|
||||
for halloween in halloweens:
|
||||
|
@ -1060,7 +1060,7 @@ class Halloween(Base):
|
|||
|
||||
@staticmethod
|
||||
def puzzle_piece_j_complete() -> bool:
|
||||
session = db.Session()
|
||||
session = Session()
|
||||
halloweens = session.query(Halloween).all()
|
||||
session.close()
|
||||
for halloween in halloweens:
|
||||
|
|
|
@ -265,6 +265,7 @@ class RoyalDiscordBot(discord.Client):
|
|||
"!skip": self.cmd_skip,
|
||||
"!s": self.cmd_skip,
|
||||
"!remove": self.cmd_remove,
|
||||
"!r": self.cmd_remove,
|
||||
"!cancel": self.cmd_remove,
|
||||
"!queue": self.cmd_queue,
|
||||
"!q": self.cmd_queue,
|
||||
|
@ -494,7 +495,7 @@ class RoyalDiscordBot(discord.Client):
|
|||
while True:
|
||||
# Fun things will happen with multiple voice clients!
|
||||
for voice_client in self.voice_clients:
|
||||
if not voice_client.is_connected() or voice_client.is_playing():
|
||||
if not voice_client.is_connected() or voice_client.is_playing() or voice_client.is_paused():
|
||||
continue
|
||||
if len(self.video_queue) == 0:
|
||||
self.now_playing = None
|
||||
|
|
|
@ -749,6 +749,21 @@ table {
|
|||
grid-column: 3;
|
||||
}
|
||||
}
|
||||
|
||||
.halloweenmini {
|
||||
background-color: #311515;
|
||||
padding: 18px;
|
||||
grid-template-columns: 100%;
|
||||
|
||||
.stars {
|
||||
grid-column: 1;
|
||||
|
||||
i {
|
||||
color: yellow;
|
||||
font-size: 30px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wiki {
|
||||
|
@ -814,6 +829,11 @@ ntry {
|
|||
.right {
|
||||
grid-column: 2;
|
||||
}
|
||||
|
||||
.halloween {
|
||||
grid-column-start: 1;
|
||||
grid-column-end: 3;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width:600px) {
|
||||
|
@ -828,6 +848,38 @@ ntry {
|
|||
.right {
|
||||
grid-row: 2;
|
||||
}
|
||||
|
||||
.halloween {
|
||||
grid-row-start: 1;
|
||||
grid-row-end: 3;
|
||||
}
|
||||
}
|
||||
|
||||
.halloween {
|
||||
.upper-box {
|
||||
font-size: xx-large;
|
||||
}
|
||||
|
||||
.lower-box {
|
||||
text-align: center;
|
||||
|
||||
.stars a {
|
||||
color: @link-color;
|
||||
font-size: 64px;
|
||||
|
||||
&:hover {
|
||||
color: @highlight-color;
|
||||
}
|
||||
|
||||
.fas {
|
||||
color: yellow;
|
||||
}
|
||||
}
|
||||
|
||||
.time-left {
|
||||
font-size: 64px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -878,28 +930,6 @@ ntry {
|
|||
}
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
0%, 100% {
|
||||
transform: translate(2px, 2px);
|
||||
}
|
||||
|
||||
20%, 80% {
|
||||
transform: translate(-2px, -2px);
|
||||
}
|
||||
|
||||
40% {
|
||||
transform: translate(2px, -2px);
|
||||
}
|
||||
|
||||
60% {
|
||||
transform: translate(-2px, 2px);
|
||||
}
|
||||
|
||||
10%, 30%, 50%, 70%, 90% {
|
||||
transform: translate(0px, 0px);
|
||||
}
|
||||
}
|
||||
|
||||
#debug-mode {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
{% block prehead %}
|
||||
<meta name="description" content="La Royal Games su {{ game_name }}">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
|
||||
{% endblock %}
|
||||
|
||||
{% block pagetitle %}
|
||||
|
|
|
@ -4,19 +4,22 @@
|
|||
Pagina principale
|
||||
{% endblock %}
|
||||
|
||||
{% block prehead %}
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
|
||||
{% endblock %}
|
||||
|
||||
{% block posthead %}
|
||||
<script>
|
||||
var audio = new Audio("{{ url_for('static', filename='ee.ogg') }}");
|
||||
|
||||
function ee() {
|
||||
fetch("/ee/r", {
|
||||
method: "POST",
|
||||
mode: "same-origin",
|
||||
credentials: "same-origin"
|
||||
});
|
||||
document.getElementById("main-title").innerHTML = '<span class="eetip" title="When there is something strange, in the neighbourhood, who you gonna call?">R</span>oyal Games';
|
||||
audio.play();
|
||||
function timer() {
|
||||
var now = new Date().getTime();
|
||||
var to = new Date("Oct 31, 2018 15:30:00").getTime();
|
||||
var result = to - now;
|
||||
document.getElementById("time-left").innerHTML = Math.floor(String((result / 3600000))) + "h "
|
||||
+ Math.floor(String((result / 60000) % 60)) + "m "
|
||||
+ Math.floor(String((result / 1000) % 60)) + "s";
|
||||
}
|
||||
|
||||
setInterval(timer, 100);
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
@ -25,6 +28,32 @@
|
|||
Royal Games
|
||||
</h1>
|
||||
<div class="main-page">
|
||||
{% if config["DEBUG"] %}
|
||||
<div class="halloween">
|
||||
<div class="box">
|
||||
<div class="upper-box">
|
||||
Rituale di Halloween!
|
||||
</div>
|
||||
<div class="lower-box">
|
||||
Lune raccolte:
|
||||
<div class="stars">
|
||||
{% for index, star in halloween %}
|
||||
{% if star %}
|
||||
<a href="/ritual/{{ index + 1 }}" title="Passo {{ index + 1 }} completato!"><i class="fas fa-moon"></i></a>
|
||||
{% else %}
|
||||
<a href="/ritual/{{ index + 1 }}" title="Passo {{ index + 1 }}"><i class="far fa-moon"></i></a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<br>
|
||||
Tempo rimanente:
|
||||
<div id="time-left" class="time-left">
|
||||
Loading...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="left">
|
||||
<div class="box">
|
||||
<div class="upper-box">
|
||||
|
@ -76,6 +105,7 @@
|
|||
<li><a href="/game/lol">League of Legends</a></li>
|
||||
<li><a href="/game/ow">Overwatch</a></li>
|
||||
<li><a href="/game/osu">osu!</a></li>
|
||||
<!--li><a href="/game/halloween">Rituale di Halloween</a></li-->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
{% block prehead %}
|
||||
<meta name="description" content="Profilo Royalnet di {{ ryg.username }}">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
|
||||
{% endblock %}
|
||||
|
||||
{% block pagetitle %}
|
||||
|
@ -37,6 +38,11 @@
|
|||
{% with record = ryg %}
|
||||
{% include "minis/ryg.html" %}
|
||||
{% endwith %}
|
||||
{% if halloween %}
|
||||
{% with record = halloween %}
|
||||
{% include "minis/halloween.html" %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{% if tg %}
|
||||
{% with record = tg %}
|
||||
{% include "minis/tg.html" %}
|
||||
|
|
21
webserver.py
21
webserver.py
|
@ -66,9 +66,21 @@ def page_main():
|
|||
random_diario = db_session.query(db.Diario).order_by(db.func.random()).first()
|
||||
next_events = db_session.query(db.Event).filter(db.Event.time > datetime.datetime.now()).order_by(
|
||||
db.Event.time).all()
|
||||
halloween = [
|
||||
db.Halloween.puzzle_piece_a_complete(),
|
||||
db.Halloween.puzzle_piece_b_complete(),
|
||||
db.Halloween.puzzle_piece_c_complete(),
|
||||
db.Halloween.puzzle_piece_d_complete(),
|
||||
db.Halloween.puzzle_piece_e_complete(),
|
||||
db.Halloween.puzzle_piece_f_complete(),
|
||||
db.Halloween.puzzle_piece_g_complete(),
|
||||
db.Halloween.puzzle_piece_h_complete(),
|
||||
db.Halloween.puzzle_piece_i_complete(),
|
||||
db.Halloween.puzzle_piece_j_complete()
|
||||
]
|
||||
db_session.close()
|
||||
return render_template("main.html", royals=royals, wiki_pages=wiki_pages, entry=random_diario,
|
||||
next_events=next_events, rygconf=config, escape=escape)
|
||||
next_events=next_events, rygconf=config, escape=escape, halloween=enumerate(halloween))
|
||||
|
||||
|
||||
@app.route("/profile/<name>")
|
||||
|
@ -89,6 +101,7 @@ def page_profile(name: str):
|
|||
tg = db_session.query(db.Telegram).filter_by(royal=user).one_or_none()
|
||||
discord = db_session.execute(query_discord_music.one_query, {"royal": user.id}).fetchone()
|
||||
gamelog = db_session.query(db.GameLog).filter_by(royal=user).one_or_none()
|
||||
halloween = db_session.query(db.Halloween).filter_by(royal=user).one_or_none()
|
||||
db_session.close()
|
||||
if css is not None:
|
||||
converted_bio = Markup(markdown2.markdown(css.bio.replace("<", "<"),
|
||||
|
@ -96,7 +109,8 @@ def page_profile(name: str):
|
|||
else:
|
||||
converted_bio = ""
|
||||
return render_template("profile.html", ryg=user, css=css, osu=osu, dota=dota, lol=lol, steam=steam, ow=ow,
|
||||
tg=tg, discord=discord, rygconf=config, bio=converted_bio, gamelog=gamelog)
|
||||
tg=tg, discord=discord, rygconf=config, bio=converted_bio, gamelog=gamelog,
|
||||
halloween=halloween)
|
||||
|
||||
|
||||
@app.route("/login")
|
||||
|
@ -231,6 +245,9 @@ def page_game(name: str):
|
|||
elif name == "discord":
|
||||
game_name = "Discord"
|
||||
query = [dict(row) for row in db_session.execute(query_discord_music.all_query)]
|
||||
elif name == "halloween":
|
||||
game_name = "Rituale di Halloween"
|
||||
query = db_session.query(db.Halloween).all()
|
||||
else:
|
||||
abort(404)
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue