1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Create terraria prize mini

This commit is contained in:
Steffo 2019-01-08 15:54:45 +01:00
parent e09e8db84e
commit ed563c3eb2
5 changed files with 74 additions and 2 deletions

10
db.py
View file

@ -1050,6 +1050,16 @@ class Quest(Base):
return f"<Quest {self.id}: {self.title}>" return f"<Quest {self.id}: {self.title}>"
class Terraria13(Base):
__tablename__ = "terraria13"
royal_id = Column(Integer, ForeignKey("royals.id"), primary_key=True)
royal = relationship("Royal", backref="terraria13", lazy="joined")
character_name = Column(String)
contribution = Column(Integer)
# If run as script, create all the tables in the db # If run as script, create all the tables in the db
if __name__ == "__main__": if __name__ == "__main__":
print("Creating new tables...") print("Creating new tables...")

View file

@ -844,6 +844,41 @@ ul {
} }
} }
} }
.terraria13 {
border: 3px solid black;
padding: 15px;
background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), url("/static/stoneslab.png");
font-family: "Andy", sans-serif;
font-weight: bold;
color: white;
grid-row-gap: 5px;
.character {
grid-row: 1;
font-size: x-large;
}
.contribution-status {
grid-row: 2;
.contribution {
font-size: xx-large;
&.blue {
color: #8686e5;
}
&.green {
color: #92f892;
}
&.orange {
color: #e9b688;
}
}
}
}
} }
.wiki { .wiki {

View file

@ -5,7 +5,7 @@
<div class="lower-box"> <div class="lower-box">
<ul> <ul>
<li><a href="{{ url_for("page_game", name="ryg") }}">Royal Games</a></li> <li><a href="{{ url_for("page_game", name="ryg") }}">Royal Games</a></li>
<li><a href="{{ url_for("page_game", name="halloween2018") }}">Halloween 2018</a></li> <li><a href="{{ url_for("page_game", name="osu") }}">Terraria 13</a></li>
<li><a href="{{ url_for("page_game", name="tg") }}">Telegram</a></li> <li><a href="{{ url_for("page_game", name="tg") }}">Telegram</a></li>
<li><a href="{{ url_for("page_game", name="discord") }}">Discord</a></li> <li><a href="{{ url_for("page_game", name="discord") }}">Discord</a></li>
<li><a href="{{ url_for("page_game", name="steam") }}">Steam</a></li> <li><a href="{{ url_for("page_game", name="steam") }}">Steam</a></li>
@ -13,6 +13,7 @@
<li><a href="{{ url_for("page_game", name="lol") }}">League of Legends</a></li> <li><a href="{{ url_for("page_game", name="lol") }}">League of Legends</a></li>
<li><a href="{{ url_for("page_game", name="ow") }}">Overwatch</a></li> <li><a href="{{ url_for("page_game", name="ow") }}">Overwatch</a></li>
<li><a href="{{ url_for("page_game", name="osu") }}">osu!</a></li> <li><a href="{{ url_for("page_game", name="osu") }}">osu!</a></li>
<li><a href="{{ url_for("page_game", name="halloween2018") }}">Halloween 2018</a></li>
</ul> </ul>
</div> </div>
</div> </div>

View file

@ -0,0 +1,21 @@
<style>
@font-face {
font-family: "Andy";
src: url("{{ url_for('static', filename='terrariafont.ttf') }}");
font-style: normal;
font-weight: bold;
}
</style>
<div class="game-panel">
<div class="game-grid terraria13">
<div class="character">
{{ record.character_name }}
</div>
<div class="contribution-status">
<span class="contribution {% if record.contribution >= 8 %}orange{% elif record.contribution >= 5 %}green{% elif record.contribution >= 3 %}blue{% endif %}">
{{ record.contribution }}
</span>
fioryg{% if record.contribution != 1 %}i{% endif %} ottenuti per la partecipazione al server.
</div>
</div>
</div>

View file

@ -126,6 +126,7 @@ def page_profile(name: str):
discord = db_session.execute(query_discord_music.one_query, {"royal": user.id}).fetchone() 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() 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() halloween = db_session.query(db.Halloween).filter_by(royal=user).one_or_none()
terraria13 = db_session.query(db.Terraria13).filter_by(royal=user).one_or_none()
db_session.close() db_session.close()
if css is not None: if css is not None:
converted_bio = Markup(markdown2.markdown(css.bio.replace("<", "&lt;"), converted_bio = Markup(markdown2.markdown(css.bio.replace("<", "&lt;"),
@ -134,7 +135,7 @@ def page_profile(name: str):
converted_bio = "" converted_bio = ""
return render_template("profile.html", ryg=user, css=css, osu=osu, dota=dota, lol=lol, steam=steam, ow=ow, return render_template("profile.html", ryg=user, css=css, osu=osu, dota=dota, lol=lol, steam=steam, ow=ow,
tg=tg, discord=discord, g=fl_g, bio=converted_bio, gamelog=gamelog, tg=tg, discord=discord, g=fl_g, bio=converted_bio, gamelog=gamelog,
halloween=halloween) halloween=halloween, terraria13=terraria13)
@app.route("/login") @app.route("/login")
@ -269,6 +270,9 @@ def page_game(name: str):
elif name == "halloween2018": elif name == "halloween2018":
game_name = "Rituale di Halloween" game_name = "Rituale di Halloween"
query = db_session.query(db.Halloween).all() query = db_session.query(db.Halloween).all()
elif name == "terraria13":
game_name = "Terraria 13"
query = db_session.query(db.Terraria13).all()
else: else:
abort(404) abort(404)
return return
@ -309,6 +313,7 @@ def page_wiki(key: str):
elif request.method == "POST": elif request.method == "POST":
if not fl_g.logged_in: if not fl_g.logged_in:
return redirect(url_for("page_login")) return redirect(url_for("page_login"))
user = db_session.query(db.Royal).filter_by(id=fl_g.user_id).one()
new_content = request.form.get("content") new_content = request.form.get("content")
# Create new page # Create new page
if wiki_page is None: if wiki_page is None: