mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
pls no crasherino
This commit is contained in:
parent
ee3dee75d4
commit
5935b2a911
15 changed files with 26 additions and 498 deletions
3
cast.py
3
cast.py
|
@ -3,7 +3,7 @@ import math
|
|||
import db
|
||||
|
||||
|
||||
def cast(spell_name: str, target_name: str, platform: str, halloween_callback=None) -> str:
|
||||
def cast(spell_name: str, target_name: str, platform: str) -> str:
|
||||
spell = spell_name.capitalize()
|
||||
# Seed the rng with the spell name
|
||||
# so that spells always deal the same damage
|
||||
|
@ -41,7 +41,6 @@ def cast(spell_name: str, target_name: str, platform: str, halloween_callback=No
|
|||
crit_msg = ""
|
||||
# HALLOWEEN
|
||||
if total >= 800:
|
||||
halloween_callback()
|
||||
return f"❇️ Ho lanciato <b>{spell}</b> su " \
|
||||
f"<i>{target_name}</i>.\n" \
|
||||
f"{crit_msg}" \
|
||||
|
|
41
db.py
41
db.py
|
@ -967,47 +967,6 @@ class Halloween(Base):
|
|||
completed[i] = True
|
||||
return started, completed
|
||||
|
||||
def update(self, session):
|
||||
if self[1] is None:
|
||||
# Dota last match
|
||||
dota = session.query(Dota).join(Steam).join(Royal).filter_by(id=self.royal.id).one_or_none()
|
||||
if dota is not None:
|
||||
dota_id = Steam.to_steam_id_3(dota.steam_id)
|
||||
r = requests.get(f"https://api.opendota.com/api/players/{dota_id}/recentMatches")
|
||||
if r.status_code != 200:
|
||||
raise RequestError("Error in the Halloween Dota check.")
|
||||
j = r.json()
|
||||
match = j[0]
|
||||
if match["hero_id"] == 81 and (match["radiant_win"] ^ match["player_slot"] // 128):
|
||||
logging.debug(f"{self.royal.username} has obtained Moon A via Dota.")
|
||||
self[1] = datetime.datetime.now()
|
||||
else:
|
||||
logging.debug(f"{self.royal.username} hasn't passed the LoL challenge yet.")
|
||||
# LoL last match
|
||||
lol = session.query(LeagueOfLegends).join(Royal).filter_by(id=self.royal.id).one_or_none()
|
||||
if lol is not None:
|
||||
r = requests.get(f"https://euw1.api.riotgames.com/lol/match/v3/matchlists/by-account/{lol.account_id}"
|
||||
f"?api_key={config['League of Legends']['riot_api_key']}")
|
||||
if r.status_code != 200:
|
||||
raise RequestError("Error in the Halloween LoL check.")
|
||||
j = r.json()
|
||||
match = j["matches"][0]
|
||||
if match["champion"] == 120:
|
||||
self[1] = datetime.datetime.now()
|
||||
logging.debug(f"{self.royal.username} has obtained Moon A via LoL.")
|
||||
else:
|
||||
logging.debug(f"{self.royal.username} hasn't passed the LoL challenge yet.")
|
||||
if self[3] is None:
|
||||
# osu! sss
|
||||
osu = session.query(Osu).join(Royal).filter_by(id=self.royal.id).one_or_none()
|
||||
if osu is not None:
|
||||
r = requests.get(f"https://osu.ppy.sh/api/get_scores"
|
||||
f"?k={config['Osu!']['ppy_api_key']}&b=2038&u={osu.osu_id}")
|
||||
j = r.json()
|
||||
if len(j) > 0:
|
||||
self[3] = datetime.datetime.now()
|
||||
|
||||
|
||||
# If run as script, create all the tables in the db
|
||||
if __name__ == "__main__":
|
||||
print("Creating new tables...")
|
||||
|
|
|
@ -220,7 +220,7 @@ class SecretVideo(Video):
|
|||
# Check if the file has been downloaded
|
||||
if not self.downloaded:
|
||||
raise FileNotDownloadedError()
|
||||
return discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(f"./static/{self.file}", **ffmpeg_settings))
|
||||
return discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(f"./opusfiles/{self.file}", **ffmpeg_settings))
|
||||
|
||||
|
||||
def command(func):
|
||||
|
@ -567,14 +567,6 @@ class RoyalDiscordBot(discord.Client):
|
|||
filename=now_playing.plain_text(),
|
||||
timestamp=datetime.datetime.now())
|
||||
session.add(played_music)
|
||||
# EASTER EGG, REMOVE LATER
|
||||
if "ghostbusters" in now_playing.plain_text().lower():
|
||||
halloween = await loop.run_in_executor(executor, session.query(db.Halloween)
|
||||
.filter_by(royal=enqueuer.royal)
|
||||
.one_or_none)
|
||||
if halloween is not None:
|
||||
halloween[5] = datetime.datetime.now()
|
||||
# END
|
||||
await loop.run_in_executor(executor, session.commit)
|
||||
await loop.run_in_executor(executor, session.close)
|
||||
except sqlalchemy.exc.OperationalError:
|
||||
|
@ -706,7 +698,7 @@ class RoyalDiscordBot(discord.Client):
|
|||
if self.radio_messages:
|
||||
self.next_radio_message_in -= 1
|
||||
if self.next_radio_message_in <= 0:
|
||||
radio_message = random.sample(spooky_radio_messages if db.Halloween.puzzle_status()[0] else radio_messages, 1)[0]
|
||||
radio_message = random.sample(radio_messages, 1)[0]
|
||||
self.next_radio_message_in = int(config["Discord"]["radio_messages_every"])
|
||||
await self.add_video_from_url(radio_message)
|
||||
await channel.send(f"📻 Aggiunto un messaggio radio, disattiva con `!radiomessages off`.")
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
from flask import Flask, render_template, request, abort, redirect, url_for
|
||||
from flask import g as fl_g
|
||||
import db
|
||||
import configparser
|
||||
import datetime
|
||||
import telegram
|
||||
from raven.contrib.flask import Sentry
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
app.jinja_env.trim_blocks = True
|
||||
app.jinja_env.lstrip_blocks = True
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read("config.ini")
|
||||
|
||||
app.secret_key = config["Flask"]["secret_key"]
|
||||
|
||||
telegram_bot = telegram.Bot(config["Telegram"]["bot_token"])
|
||||
|
||||
sentry = Sentry(app, dsn=config["Sentry"]["token"])
|
||||
|
||||
|
||||
@app.before_request
|
||||
def pre_request():
|
||||
fl_g.event_started, fl_g.event_progress = db.Halloween.puzzle_status()
|
||||
fl_g.all_moons_done = True
|
||||
for moon in fl_g.event_progress:
|
||||
if not moon:
|
||||
fl_g.all_moons_done = False
|
||||
fl_g.time_left = datetime.datetime.fromtimestamp(1540999800) - datetime.datetime.now()
|
||||
fl_g.display_on_main_site = (fl_g.time_left < datetime.timedelta(days=7)) or __debug__
|
||||
fl_g.css = "spoopy.less" if (fl_g.event_started or __debug__) else "nryg.less"
|
||||
fl_g.rygconf = config
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def page_owlcaptain():
|
||||
return render_template("owlcaptain.html")
|
||||
|
||||
|
||||
@app.route("/voiceofevil", methods=["POST"])
|
||||
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=request.form["user_id"]).one_or_none()
|
||||
if halloween is None:
|
||||
abort(403)
|
||||
return
|
||||
halloween[4] = datetime.datetime.now()
|
||||
db_session.commit()
|
||||
return redirect(url_for("page_owlcaptain"))
|
||||
|
||||
|
||||
@app.route("/mansion", methods=["POST"])
|
||||
def page_mansion():
|
||||
if request.form.get("solution", "") != "bobooboooboooo":
|
||||
abort(400)
|
||||
return
|
||||
db_session = db.Session()
|
||||
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[6] = datetime.datetime.now()
|
||||
db_session.commit()
|
||||
return redirect(url_for("page_owlcaptain"))
|
||||
|
||||
|
||||
@app.route("/whatpumpkin", methods=["POST"])
|
||||
def page_whatpumpkin():
|
||||
return redirect("https://t.me/Steffo")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True, port=1234)
|
|
@ -42,4 +42,4 @@ listona = ["della secca", "del seccatore", "del secchiello", "del secchio", "del
|
|||
"della scatola", "del supercalifragilistichespiralidoso", "del sale", "del salame", "di (Town of) Salem",
|
||||
"di Stronghold", "di SOMA", "dei Saints", "di S.T.A.L.K.E.R.", "di Sanctum", "dei Sims", "di Sid",
|
||||
"delle Skullgirls", "di Sonic", "di Spiral (Knights)", "di Spore", "di Starbound", "di SimCity", "di Sensei",
|
||||
"di Ssssssssssssss... Boom! E' esploso il dizionario", "della scala", "di Sakura"]
|
||||
"di Ssssssssssssss... Boom! E' esploso il dizionario", "della scala", "di Sakura", "di Suzie"]
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -878,6 +878,16 @@ table {
|
|||
}
|
||||
}
|
||||
|
||||
.mysterystatus i {
|
||||
&.todo {
|
||||
color: rgba(255, 255, 0, 0.2);
|
||||
}
|
||||
|
||||
&.done {
|
||||
color: rgba(255, 255, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
#debug-mode {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
body {
|
||||
background-color: black;
|
||||
color: white;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#time-left {
|
||||
font-family: monospace;
|
||||
font-size: 110px;
|
||||
color: grey;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 900px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.quest {
|
||||
display: grid;
|
||||
grid-template-columns: 64px auto;
|
||||
grid-column-gap: 12px;
|
||||
margin-top: 36px;
|
||||
margin-bottom: 36px;
|
||||
|
||||
.progress {
|
||||
grid-row-start: 1;
|
||||
grid-row-end: 4;
|
||||
grid-column: 1;
|
||||
|
||||
i {
|
||||
display: block;
|
||||
padding-top: 8px;
|
||||
font-size: 64px;
|
||||
color: yellow;
|
||||
|
||||
&.todo {
|
||||
color: rgba(255, 255, 0, 0.2);
|
||||
}
|
||||
|
||||
&.done {
|
||||
color: rgba(255, 255, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
h2 {
|
||||
grid-row: 1;
|
||||
grid-column: 2;
|
||||
margin-top: 0;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.description {
|
||||
grid-row: 2;
|
||||
grid-column: 2;
|
||||
}
|
||||
|
||||
form {
|
||||
grid-row: 3;
|
||||
grid-column: 2;
|
||||
}
|
||||
}
|
|
@ -72,9 +72,6 @@ def process():
|
|||
logger.info("Pausing for 30 minutes.")
|
||||
time.sleep(1800)
|
||||
session = db.Session()
|
||||
logger.info("Now updating Halloween data.")
|
||||
update_block(session, session.query(db.Halloween).all())
|
||||
session.commit()
|
||||
logger.info("Now updating Steam data.")
|
||||
update_block(session, session.query(db.Steam).all())
|
||||
session.commit()
|
||||
|
|
|
@ -124,30 +124,15 @@ def cmd_cast(bot: Bot, update: Update):
|
|||
session = db.Session()
|
||||
# Find a target for the spell
|
||||
target = random.sample(session.query(db.Telegram).all(), 1)[0]
|
||||
# HALLOWEEN
|
||||
caster = session.query(db.Telegram).filter_by(telegram_id=update.message.from_user.id).join(db.Royal).one_or_none()
|
||||
|
||||
def callback():
|
||||
if caster is None:
|
||||
return
|
||||
nsession = db.Session()
|
||||
halloween = nsession.query(db.Halloween).filter_by(royal=caster.royal).one_or_none()
|
||||
if halloween is not None:
|
||||
halloween[7] = datetime.datetime.now()
|
||||
nsession.commit()
|
||||
nsession.close()
|
||||
# Close the session
|
||||
session.close()
|
||||
# END
|
||||
bot.send_message(update.message.chat.id, cast.cast(spell_name=spell, halloween_callback=callback,
|
||||
bot.send_message(update.message.chat.id, cast.cast(spell_name=spell,
|
||||
target_name=target.username if target.username is not None
|
||||
else target.first_name, platform="telegram"),
|
||||
parse_mode="HTML")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@catch_and_report
|
||||
def cmd_color(bot: Bot, update: Update):
|
||||
bot.send_message(update.message.chat.id, "I am sorry, unknown error occured during working with your request,"
|
||||
|
@ -328,48 +313,6 @@ def on_callback_query(bot: Bot, update: Update):
|
|||
session.close()
|
||||
|
||||
|
||||
@catch_and_report
|
||||
def cmd_ban(bot: Bot, update: Update):
|
||||
if datetime.date.today() != datetime.date(2019, 4, 1):
|
||||
bot.send_message(update.message.chat.id, "⚠ Non è il giorno adatto per bannare persone!")
|
||||
return
|
||||
session = db.Session()
|
||||
try:
|
||||
last_bans = session.query(db.AprilFoolsBan).filter(db.AprilFoolsBan.datetime > (datetime.datetime.now() - datetime.timedelta(minutes=15))).all()
|
||||
if len(last_bans) > 0:
|
||||
bot.send_message(update.message.chat.id, "⚠ /ban è in cooldown.\n"
|
||||
"Può essere usato solo 1 volta ogni 15 minuti!")
|
||||
return
|
||||
try:
|
||||
arg = update.message.text.split(" ", 1)[1]
|
||||
except IndexError:
|
||||
bot.send_message(update.message.chat.id, "⚠ Devi specificare un bersaglio!")
|
||||
return
|
||||
target_user = session.query(db.Telegram).filter_by(username=arg).one_or_none()
|
||||
if target_user is None:
|
||||
bot.send_message(update.message.chat.id, "⚠ Il bersaglio specificato non esiste nel RYGdb.\n"
|
||||
"Le possibilità sono due: non è un membro RYG, "
|
||||
"oppure non si è ancora registrato e va bannato manualmente.")
|
||||
return
|
||||
if int(target_user.telegram_id) == 25167391:
|
||||
bot.send_message(update.message.chat.id, "⚠ Il creatore della chat non può essere espulso.")
|
||||
return
|
||||
bannerino = db.AprilFoolsBan(from_user_id=update.message.from_user.id, to_user_id=target_user.telegram_id, datetime=datetime.datetime.now())
|
||||
session.add(bannerino)
|
||||
session.commit()
|
||||
bot.kick_chat_member(update.message.chat.id, target_user.telegram_id)
|
||||
bot.unban_chat_member(update.message.chat.id, target_user.telegram_id)
|
||||
try:
|
||||
bot.send_message(target_user.telegram_id, "https://t.me/joinchat/AYAGH0TEav8WcbPVfNe75A")
|
||||
except Exception:
|
||||
pass
|
||||
bot.send_message(update.message.chat.id, "🔨")
|
||||
except Exception as e:
|
||||
pass
|
||||
finally:
|
||||
session.close()
|
||||
|
||||
|
||||
@catch_and_report
|
||||
def cmd_eat(bot: Bot, update: Update):
|
||||
try:
|
||||
|
|
|
@ -28,32 +28,6 @@
|
|||
Royal Games
|
||||
</h1>
|
||||
<div class="main-page">
|
||||
{% if g.event_started %}
|
||||
<div class="halloween">
|
||||
<div class="box">
|
||||
<div class="upper-box">
|
||||
owlcaptain.tk
|
||||
</div>
|
||||
<div class="lower-box">
|
||||
Lune raccolte:
|
||||
<div class="mysterystatus">
|
||||
{% for index, star in halloween %}
|
||||
{% if star %}
|
||||
<i class="fas fa-moon done"></i>
|
||||
{% else %}
|
||||
<i class="far fa-moon todo"></i>
|
||||
{% 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">
|
||||
|
@ -61,7 +35,7 @@
|
|||
</div>
|
||||
<div class="lower-box">
|
||||
{% for event in next_events %}
|
||||
{% include "/components/event.html" %}
|
||||
{% include "components/event.html" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,187 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="keywords" content="Royal Games, halloween, arg">
|
||||
<title>a curse.</title>
|
||||
<link href="{{ url_for('static', filename='owl.less') }}" rel="stylesheet/less" type="text/css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/3.0.2/less.min.js"></script>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
|
||||
<script>
|
||||
var username;
|
||||
var user_id;
|
||||
var sound = new Audio("{{ url_for('static', filename='endgame.ogg') }}");
|
||||
|
||||
function timer() {
|
||||
let now = new Date().getTime();
|
||||
let to = new Date("Oct 31, 2018 15:30:00").getTime();
|
||||
let 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";
|
||||
}
|
||||
|
||||
function ident() {
|
||||
let r = fetch("https://ryg.steffo.eu/ses/identify", {
|
||||
method: "GET",
|
||||
mode: "cors",
|
||||
credentials: "include"
|
||||
}).done((result) => {
|
||||
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 = result["id"];
|
||||
username = result["username"];
|
||||
document.getElementsByName("user_id").forEach((item) => {
|
||||
item.setAttribute("value", user_id);
|
||||
})
|
||||
sound.loop = true;
|
||||
sound.play();
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
setInterval(timer, 100);
|
||||
window.onload = ident;
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="main" class="container">
|
||||
<h1>
|
||||
a curse.
|
||||
</h1>
|
||||
<div class="timer">
|
||||
<span id="time-left"></span>
|
||||
</div>
|
||||
<div class="curse">
|
||||
a curse lies in waiting for the night of the dead.<br>
|
||||
you and your friends are in danger.<br>
|
||||
stop it before it activates.<br>
|
||||
<br>
|
||||
i'm willing to help you.<br>
|
||||
you will have to perform a ritual.<br>
|
||||
here are the steps.<br>
|
||||
<br>
|
||||
you can perform them in any order, except for the final step.<br>
|
||||
i'll reveal that when all others are complete, just to be safe.
|
||||
</div>
|
||||
<div class="subquests">
|
||||
{% if g.all_moons_done %}
|
||||
<div class="quest">
|
||||
<div class="progress">
|
||||
<i class="far fa-moon todo"></i>
|
||||
</div>
|
||||
<h1>
|
||||
PERFORM THE RITUAL!
|
||||
</h1>
|
||||
<div class="description">
|
||||
if <a href="https://ryg.steffo.eu/game/halloween">you have enough moons</a>, prepare for a journey to the unknown.<br>
|
||||
when the time runs out, prepare for the ritual.<br>
|
||||
you'll receive the location through a safe channel, please do not spread it.
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% for quest in g.event_progress %}
|
||||
<div class="quest {% if quest %}quest-clear{% endif %}" id="{{ loop.index }}">
|
||||
<div class="progress">
|
||||
{% if quest %}
|
||||
<i class="fas fa-moon done"></i>
|
||||
{% else %}
|
||||
<i class="far fa-moon todo"></i>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if loop.index == 1 %}
|
||||
{# hecarim o chaos knight #}
|
||||
<h2>
|
||||
unleash the horsemen
|
||||
</h2>
|
||||
<div class="description">
|
||||
you'll need the help of the horsemen of the apocalypse to dispel the curse.<br>
|
||||
lead Chaos to victory in the battle of the ancients, or summon War from the shadow isles on the rift, and you'll gain their support.
|
||||
</div>
|
||||
{% elif loop.index == 2 %}
|
||||
{# la zucca di balu e max #}
|
||||
<h2>
|
||||
<u title="updated">♦</u> carve the ritual pumpkin
|
||||
</h2>
|
||||
<div class="description">
|
||||
prepare a pumpkin, and empty its inside.<br>
|
||||
carve something on its exterior then put a light inside of it.<br>
|
||||
when dusk has come, take a picture, and <a href="/whatpumpkin">post it to the owl captain</a>.
|
||||
</div>
|
||||
{% elif loop.index == 3 %}
|
||||
{# https://osu.ppy.sh/beatmapsets/385#osu/2038 #}
|
||||
<h2>
|
||||
circle the sound
|
||||
</h2>
|
||||
<div class="description">
|
||||
find the 2038th sound of halloween.<br>
|
||||
then, follow the circle pattern.<br>
|
||||
<br>
|
||||
it is rather dashing, isn't it?
|
||||
</div>
|
||||
{% elif loop.index == 4 %}
|
||||
{# 1 #}
|
||||
<h2>
|
||||
<u title="updated">♦</u> uproot the evil
|
||||
</h2>
|
||||
<div class="description">
|
||||
listen to the sounds in here.<br>
|
||||
do you hear the evil that stole your voice?<br>
|
||||
answer it.<br>
|
||||
|
||||
<i>you might need a fiery fox.</i>
|
||||
</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 %}
|
||||
{# ghostbusters #}
|
||||
<h2>
|
||||
remove the ghosts
|
||||
</h2>
|
||||
<div class="description">
|
||||
during the ritual something strange might happen.<br>
|
||||
in that case, the ghosts probably will be to blame.<br>
|
||||
to be safe, i would remove them...<br>
|
||||
<br>
|
||||
who should you call?
|
||||
</div>
|
||||
{% elif loop.index == 6 %}
|
||||
<h2>
|
||||
conquer the mansion
|
||||
</h2>
|
||||
<div class="description">
|
||||
<a href="{{ url_for('static', filename='snesfile.zip') }}">a mansion</a> has appeared.<br>
|
||||
prove yourself worthy, and find the words hidden deep inside.<br>
|
||||
only then i can trust you to completely perform the ritual.
|
||||
</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 %}
|
||||
<h2>
|
||||
fire the magic
|
||||
</h2>
|
||||
<div class="description">
|
||||
the ritual requires very strong magic.<br>
|
||||
gather all your power, and hit someone with all of it.<br>
|
||||
this magic talisman will absorb it if it's strong enough.<br>
|
||||
|
||||
<i>the talisman is made of white marble, and has "800+" engraved on it.</i>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -6,16 +6,20 @@
|
|||
<meta name="description" content="{{ wiki_page.content[:97] }}...">
|
||||
{% endif %}
|
||||
<script>
|
||||
var edits = false;
|
||||
let edits = false;
|
||||
|
||||
function newEdit() {
|
||||
edits = true;
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
function onEnter() {
|
||||
edits = false;
|
||||
}
|
||||
|
||||
function onExit() {
|
||||
edits = true;
|
||||
}
|
||||
|
||||
window.onbeforeunload = function() {
|
||||
return edits ? "Modifiche non salvate" : null;
|
||||
}
|
||||
|
@ -45,7 +49,7 @@
|
|||
<form action="{{ url_for('page_wiki', key=key) }}" method="POST">
|
||||
<textarea oninput="newEdit()" class="content" name="content" placeholder="Inserisci il Markdown per la pagina qui.">{% if wiki_page %}{{ wiki_page.content }}{% endif %}</textarea><br>
|
||||
<input class="reason" name="reason" type="text" placeholder="Motivo per la modifica"><br>
|
||||
<input class="submit" type="submit" onsubmit="onSubmit()" value="Invia">
|
||||
<input class="submit" type="submit" onmouseenter="onEnter()" onmouseleave="onExit()" value="Invia">
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
25
webserver.py
25
webserver.py
|
@ -316,7 +316,7 @@ def page_wiki(key: str):
|
|||
f' <a href="https://ryg.steffo.eu/profile/{user.username}">{user.username}</a>'
|
||||
f' {"(" + edit_reason + ")" if edit_reason else ""}'
|
||||
f' [{"+" if difference > 0 else ""}{difference}]\n'
|
||||
f' {"<b>" + user.username + " è stato premiato con 1 fioryg!</b>" if fioryg_roll > fioryg_chance else ""}',
|
||||
f' {user.username + " è stato premiato con 1 fioryg!" if fioryg_roll > fioryg_chance else ""}',
|
||||
parse_mode="HTML", disable_web_page_preview=True, disable_notification=True)
|
||||
except Exception:
|
||||
pass
|
||||
|
@ -368,33 +368,14 @@ def ses_identify():
|
|||
"username": fl_session.get("username"),
|
||||
"id": fl_session.get("user_id")
|
||||
})
|
||||
if fl_session.get("user_id") is not None:
|
||||
db_session = db.Session()
|
||||
royal = db_session.query(db.Royal).filter_by(id=fl_session.get("user_id")).one_or_none()
|
||||
halloween = db_session.query(db.Halloween).filter_by(royal=royal).one_or_none()
|
||||
if halloween is None:
|
||||
if not fl_g.event_started:
|
||||
try:
|
||||
telegram_bot.send_message(config["Telegram"]["main_group"],
|
||||
f"💀 <b>Che le settimane dello spavento abbiano inizio!</b>",
|
||||
parse_mode="HTML", disable_web_page_preview=True)
|
||||
except Exception:
|
||||
pass
|
||||
halloween = db.Halloween(royal=royal, first_trigger=datetime.datetime.now())
|
||||
db_session.add(halloween)
|
||||
db_session.commit()
|
||||
db_session.close()
|
||||
response.headers["Access-Control-Allow-Origin"] = "https://owlcaptain.tk"
|
||||
response.headers["Access-Control-Allow-Origin"] = "https://steffo.eu"
|
||||
response.headers["Access-Control-Allow-Credentials"] = "true"
|
||||
return response
|
||||
|
||||
|
||||
@app.before_request
|
||||
def pre_request():
|
||||
fl_g.event_started, fl_g.event_progress = db.Halloween.puzzle_status()
|
||||
fl_g.time_left = datetime.datetime.fromtimestamp(1540999800) - datetime.datetime.now()
|
||||
fl_g.display_on_main_site = (fl_g.time_left < datetime.timedelta(days=7)) or __debug__
|
||||
fl_g.css = "spoopy.less" if fl_g.event_started else "nryg.less"
|
||||
fl_g.css = "nryg.less"
|
||||
fl_g.rygconf = config
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue