mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 11:34:18 +00:00
complete trionfi
This commit is contained in:
parent
1e41892f1d
commit
a1f44ff1af
4 changed files with 74 additions and 7 deletions
64
royalpack/halloween2020/api_user_trionfi.py
Normal file
64
royalpack/halloween2020/api_user_trionfi.py
Normal file
|
@ -0,0 +1,64 @@
|
|||
import datetime
|
||||
import royalnet.backpack.tables as rbt
|
||||
import royalnet.constellation.api as rca
|
||||
from .trionfistatus import TrionfiStatus
|
||||
|
||||
|
||||
class ApiUserTrionfiStar(rca.ApiStar):
|
||||
path = "/api/user/trionfi/v2"
|
||||
|
||||
parameters = {
|
||||
"get": {
|
||||
"uid": "(Choose one) The id of the user to get information about.",
|
||||
"alias": "(Choose one) The alias of the user to get information about.",
|
||||
}
|
||||
}
|
||||
|
||||
auth = {
|
||||
"get": True
|
||||
}
|
||||
|
||||
tags = ["user"]
|
||||
|
||||
async def get_user(self, data: rca.ApiData):
|
||||
uid = data.int("uid", optional=True)
|
||||
alias = data.str("alias", optional=True)
|
||||
|
||||
if uid:
|
||||
user = await rbt.User.find(self.alchemy, data.session, uid)
|
||||
elif alias:
|
||||
user = await rbt.User.find(self.alchemy, data.session, alias)
|
||||
else:
|
||||
raise rca.MissingParameterError("Neither uid or alias were specified.")
|
||||
|
||||
if user is None:
|
||||
raise rca.NotFoundError("No such user.")
|
||||
|
||||
return user
|
||||
|
||||
@rca.magic
|
||||
async def get(self, data: rca.ApiData) -> dict:
|
||||
"""Get Royalpack information about a user."""
|
||||
author = await data.user()
|
||||
if len(author.steam) >= 1:
|
||||
steam = author.steam[0]
|
||||
if steam.trionfistatus is None:
|
||||
TrionfiStatusT = self.alchemy.get(TrionfiStatus)
|
||||
ts = TrionfiStatusT(steam=steam)
|
||||
data.session.add(ts)
|
||||
await data.session_commit()
|
||||
if not steam.trionfistatus.zero:
|
||||
steam.trionfistatus.zero = datetime.datetime.now()
|
||||
await data.session_commit()
|
||||
|
||||
user = await self.get_user(data)
|
||||
result = {
|
||||
**user.json(),
|
||||
"bio": user.bio.json() if user.bio is not None else None,
|
||||
"fiorygi": user.fiorygi.fiorygi if user.fiorygi is not None else None,
|
||||
"steam": [steam.json() for steam in user.steam],
|
||||
"leagueoflegends": [leagueoflegends.json() for leagueoflegends in user.leagueoflegends],
|
||||
"osu": [osu.json() for osu in user.osu],
|
||||
"trivia": user.trivia_score.json() if user.trivia_score is not None else None,
|
||||
}
|
||||
return result
|
|
@ -9,7 +9,7 @@ trionfilist: List[TrionfoInfo] = [
|
|||
roman="0",
|
||||
name="Il Folle",
|
||||
puzzle="UN VIAGGIO TI ATTENDE",
|
||||
objective="Partecipa ai Trionfi Reali.",
|
||||
objective="Trova la pagina dei Trionfi Reali.",
|
||||
check=NullCheck(),
|
||||
),
|
||||
TrionfoInfo(
|
||||
|
@ -18,7 +18,7 @@ trionfilist: List[TrionfoInfo] = [
|
|||
roman="I",
|
||||
name="Il Mago",
|
||||
puzzle="L'ULTIMO GIORNO",
|
||||
objective="Trova una /spell che possa fare almeno 250 danni.",
|
||||
objective="Scopri una magia che possa fare più di 250 danni.",
|
||||
check=NullCheck(),
|
||||
),
|
||||
TrionfoInfo(
|
||||
|
@ -55,7 +55,7 @@ trionfilist: List[TrionfoInfo] = [
|
|||
name="Il Papa",
|
||||
puzzle="ALLA DECIMASESTA ORA",
|
||||
objective="Completa la prima zona di [url=https://store.steampowered.com/app/247080]Crypt of the Necrodancer["
|
||||
"/url] (con qualsiasi personaggio).",
|
||||
"/url] con qualsiasi personaggio.",
|
||||
check=CheckAchievementSteamGame(247080, "ACH_ZONE1_COMPLETE")
|
||||
),
|
||||
TrionfoInfo(
|
||||
|
@ -64,7 +64,7 @@ trionfilist: List[TrionfoInfo] = [
|
|||
roman="VI",
|
||||
name="Gli Amanti",
|
||||
puzzle="ANCORA TRENTA MINUTI",
|
||||
objective="Finisci l'Atto 3 di [url=https://store.steampowered.com/app/698780]Doki Doki Literature Club["
|
||||
objective="Gioca almeno mezz'ora a [url=https://store.steampowered.com/app/698780]Doki Doki Literature Club["
|
||||
"/url].",
|
||||
check=CheckPlayedSteamGame(698780),
|
||||
),
|
||||
|
@ -74,7 +74,7 @@ trionfilist: List[TrionfoInfo] = [
|
|||
roman="VII",
|
||||
name="Il Carro",
|
||||
puzzle="SOPRA UN CARRO",
|
||||
objective="Gioca 5 incontri a [url=https://store.steampowered.com/app/326460/ShellShock_Live]ShellShock Live["
|
||||
objective="Gioca 5 incontri di [url=https://store.steampowered.com/app/326460/ShellShock_Live]ShellShock Live["
|
||||
"/url].",
|
||||
check=CheckAchievementSteamGame(326460, "play5")
|
||||
),
|
||||
|
@ -209,7 +209,7 @@ trionfilist: List[TrionfoInfo] = [
|
|||
roman="XXI",
|
||||
name="Il Mondo",
|
||||
puzzle="""44°35'45.0"N 11°02'58.9"E""",
|
||||
objective="???",
|
||||
objective="Attraverso i Trionfi, il segreto ti sarà lentamente rivelato...",
|
||||
check=NullCheck(),
|
||||
),
|
||||
]
|
|
@ -15,6 +15,7 @@ from .api_user_avatar import ApiUserAvatarStar
|
|||
from .api_auth_login_osu import ApiAuthLoginOsuStar
|
||||
from .api_diario_range import ApiDiarioRangeStar
|
||||
from .api_diario_latest import ApiDiarioLatestStar
|
||||
from ..halloween2020.api_user_trionfi import ApiUserTrionfiStar
|
||||
|
||||
# Enter the PageStars of your Pack here!
|
||||
available_page_stars = [
|
||||
|
@ -34,6 +35,7 @@ available_page_stars = [
|
|||
ApiAuthLoginOsuStar,
|
||||
ApiDiarioRangeStar,
|
||||
ApiDiarioLatestStar,
|
||||
ApiUserTrionfiStar,
|
||||
]
|
||||
|
||||
# Don't change this, it should automatically generate __all__
|
||||
|
|
|
@ -77,7 +77,8 @@ class Steam:
|
|||
|
||||
"dota": self.dota.json() if self.dota is not None else None,
|
||||
"brawlhalla": self.brawlhalla.json() if self.brawlhalla is not None else None,
|
||||
"trionfistatus": self.trionfistatus.json() if self.trionfistatus is not None else None,
|
||||
"trionfistatus": self.trionfistatus.json() if (self.trionfistatus is not None and self.trionfistatus.zero
|
||||
is not None) else None,
|
||||
}
|
||||
|
||||
def __repr__(self):
|
||||
|
|
Loading…
Reference in a new issue