mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
asdadsasdasda
This commit is contained in:
parent
cd44cb150d
commit
2036ec2515
5 changed files with 26 additions and 54 deletions
21
db.py
21
db.py
|
@ -898,9 +898,6 @@ class Halloween(Base):
|
|||
puzzle_piece_e = Column(DateTime)
|
||||
puzzle_piece_f = Column(DateTime)
|
||||
puzzle_piece_g = Column(DateTime)
|
||||
puzzle_piece_h = Column(DateTime)
|
||||
puzzle_piece_i = Column(DateTime)
|
||||
puzzle_piece_j = Column(DateTime)
|
||||
|
||||
boss_battle = Column(DateTime)
|
||||
|
||||
|
@ -921,12 +918,6 @@ class Halloween(Base):
|
|||
return self.puzzle_piece_f
|
||||
elif item == 7:
|
||||
return self.puzzle_piece_g
|
||||
elif item == 8:
|
||||
return self.puzzle_piece_h
|
||||
elif item == 9:
|
||||
return self.puzzle_piece_i
|
||||
elif item == 10:
|
||||
return self.puzzle_piece_j
|
||||
else:
|
||||
raise ValueError("No such puzzle piece")
|
||||
|
||||
|
@ -947,18 +938,12 @@ class Halloween(Base):
|
|||
self.puzzle_piece_f = value
|
||||
elif key == 7:
|
||||
self.puzzle_piece_g = value
|
||||
elif key == 8:
|
||||
self.puzzle_piece_h = value
|
||||
elif key == 9:
|
||||
self.puzzle_piece_i = value
|
||||
elif key == 10:
|
||||
self.puzzle_piece_j = value
|
||||
else:
|
||||
raise ValueError("No such puzzle piece")
|
||||
|
||||
def pieces_completed(self) -> int:
|
||||
count = 0
|
||||
for i in range(1, 11):
|
||||
for i in range(1, 8):
|
||||
if self[i]:
|
||||
count += 1
|
||||
return count
|
||||
|
@ -969,9 +954,9 @@ class Halloween(Base):
|
|||
halloweens = session.query(Halloween).all()
|
||||
session.close()
|
||||
started = bool(halloweens)
|
||||
completed = [False for _ in range(10)]
|
||||
completed = [False for _ in range(7)]
|
||||
for h in halloweens:
|
||||
for i in range(10):
|
||||
for i in range(7):
|
||||
if h[i+1]:
|
||||
completed[i] = True
|
||||
return started, completed
|
||||
|
|
|
@ -526,7 +526,7 @@ class RoyalDiscordBot(discord.Client):
|
|||
if "ghostbusters" in now_playing.plain_text().lower():
|
||||
halloween = await loop.run_in_executor(executor, session.query(db.Halloween)
|
||||
.filter_by(royal=enqueuer).one_or_none)
|
||||
halloween[4] = True
|
||||
halloween[5] = datetime.datetime.now()
|
||||
# END
|
||||
await loop.run_in_executor(executor, session.commit)
|
||||
await loop.run_in_executor(executor, session.close)
|
||||
|
|
|
@ -47,12 +47,15 @@ def page_voiceofevil():
|
|||
if request.form.get("solution", "") != "1":
|
||||
abort(400)
|
||||
return
|
||||
if "user_id" not in request.form:
|
||||
abort(403)
|
||||
return
|
||||
db_session = db.Session()
|
||||
halloween = db_session.query(db.Halloween).filter_by(royal_id=fl_session["user_id"]).one_or_none()
|
||||
halloween = db_session.query(db.Halloween).filter_by(royal_id=request.form["user_id"]).one_or_none()
|
||||
if halloween is None:
|
||||
abort(403)
|
||||
return
|
||||
halloween[3] = True
|
||||
halloween[4] = datetime.datetime.now()
|
||||
db_session.commit()
|
||||
return redirect(url_for("page_owlcaptain"))
|
||||
|
||||
|
@ -63,11 +66,11 @@ def page_mansion():
|
|||
abort(400)
|
||||
return
|
||||
db_session = db.Session()
|
||||
halloween = db_session.query(db.Halloween).filter_by(royal_id=fl_session["user_id"]).one_or_none()
|
||||
halloween = db_session.query(db.Halloween).filter_by(royal_id=request.form["user_id"]).one_or_none()
|
||||
if halloween is None:
|
||||
abort(403)
|
||||
return
|
||||
halloween[5] = True
|
||||
halloween[6] = datetime.datetime.now()
|
||||
db_session.commit()
|
||||
return redirect(url_for("page_owlcaptain"))
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
Lune ottenute
|
||||
</div>
|
||||
<div class="game-score mysterystatus">
|
||||
{% for index in range(10) %}
|
||||
{% for index in range(7) %}
|
||||
{% if record[index + 1] %}
|
||||
<i class="fas fa-moon done"></i>
|
||||
{% else %}
|
||||
|
|
|
@ -27,15 +27,18 @@
|
|||
mode: "cors",
|
||||
credentials: "include"
|
||||
}).done((result) => {
|
||||
data = result.json();
|
||||
if(data["user_id"] === null) {
|
||||
result.json().done((result) => {
|
||||
if(result["id"] === null) {
|
||||
document.getElementById("main").innerHTML = "i don't know you. " +
|
||||
"<a href='https://ryg.steffo.eu/login'>try logging in</a> first.";
|
||||
return;
|
||||
user_id = data["user_id"];
|
||||
username = data["username"];
|
||||
}
|
||||
|
||||
user_id = result["id"];
|
||||
username = result["username"];
|
||||
document.getElementsByName("user_id").forEach((item) => {
|
||||
item.setAttribute("value", user_id);
|
||||
})
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -114,6 +117,7 @@
|
|||
</div>
|
||||
<form action="/voiceofevil" method="POST">
|
||||
<input name="solution" type="text" placeholder="?">
|
||||
<input type="hidden" name="user_id">
|
||||
<input type="submit" value="this is my answer!">
|
||||
</form>
|
||||
{% elif loop.index == 5 %}
|
||||
|
@ -138,6 +142,7 @@
|
|||
</div>
|
||||
<form action="/mansion" method="POST">
|
||||
<input name="solution" type="text" placeholder="?">
|
||||
<input type="hidden" name="user_id">
|
||||
<input type="submit" value="this is my answer!">
|
||||
</form>
|
||||
{% elif loop.index == 7 %}
|
||||
|
@ -146,27 +151,6 @@
|
|||
</h2>
|
||||
<div class="description">
|
||||
|
||||
</div>
|
||||
{% elif loop.index == 8 %}
|
||||
<h2>
|
||||
|
||||
</h2>
|
||||
<div class="description">
|
||||
|
||||
</div>
|
||||
{% elif loop.index == 9 %}
|
||||
<h2>
|
||||
|
||||
</h2>
|
||||
<div class="description">
|
||||
|
||||
</div>
|
||||
{% elif loop.index == 10 %}
|
||||
<h2>
|
||||
|
||||
</h2>
|
||||
<div class="description">
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue