From adb55cc6f0bddf2686006c5ba0bcbdcd5426c24f Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 23 Sep 2020 03:10:27 +0200 Subject: [PATCH] Make more progress --- royalpack/commands/fortune.py | 18 +++++++++---- royalpack/commands/spell.py | 1 + royalpack/halloween2020/check.py | 2 ++ royalpack/halloween2020/trionfilist.py | 36 ++++++++++++++++++++------ 4 files changed, 44 insertions(+), 13 deletions(-) diff --git a/royalpack/commands/fortune.py b/royalpack/commands/fortune.py index 142e8e3f..f839220a 100644 --- a/royalpack/commands/fortune.py +++ b/royalpack/commands/fortune.py @@ -1,6 +1,7 @@ from typing import * import royalnet import royalnet.commands as rc +import royalnet.utils as ru import random import datetime @@ -58,16 +59,23 @@ class FortuneCommand(rc.Command): "🔙 Oggi torneai indietro nel tempo!", "🚨 Oggi suonerà l'allarme della Velvet Room!", "♾ Oggi ti sembrerà infinito!", + "👹 Oggi perfino i demoni avranno paura di te!", + "🥐 Oggi mangerai una brioche (o lancerai un boomerang)!", ] async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None: async with data.session_acm() as session: author = await data.find_author(session=session, required=True) - today = datetime.date.today() + today = datetime.date.today() - h = author.uid * hash(today) + h = author.uid * hash(today) - r = random.Random(x=h) + r = random.Random(x=h) + + if author is not None and author.halloween2020 is not None: + author.halloween2020.x = datetime.datetime.now() + await ru.asyncify(session.commit) + + message = r.sample(self._fortunes, 1)[0] + await data.reply(message) - message = r.sample(self._fortunes, 1)[0] - await data.reply(message) diff --git a/royalpack/commands/spell.py b/royalpack/commands/spell.py index d6c20489..a6e4230e 100644 --- a/royalpack/commands/spell.py +++ b/royalpack/commands/spell.py @@ -35,6 +35,7 @@ class SpellCommand(rc.Command): author = await data.find_author(session=session, required=False) if author is not None and author.halloween2020 is not None: author.halloween2020.i = datetime.datetime.now() + await ru.asyncify(session.commit) if spell.healing_component: heal: rs.HealingComponent = spell.healing_component diff --git a/royalpack/halloween2020/check.py b/royalpack/halloween2020/check.py index f7472291..22742b5a 100644 --- a/royalpack/halloween2020/check.py +++ b/royalpack/halloween2020/check.py @@ -73,6 +73,8 @@ class CheckAchievementSteamGame(Check): j = await response.json() except Exception: return False + if not j["playerstats"]["success"]: + return False achievements = j["playerstats"]["achievements"] for ach in achievements: diff --git a/royalpack/halloween2020/trionfilist.py b/royalpack/halloween2020/trionfilist.py index 74623cab..48b1eb79 100644 --- a/royalpack/halloween2020/trionfilist.py +++ b/royalpack/halloween2020/trionfilist.py @@ -24,7 +24,7 @@ trionfilist = ( variable="ii", title="ii", roman="II", - name="La Sacerdotessa", + name="L'Alta Sacerdotessa", puzzle="DEL DECIMO MESE", objective="Gioca almeno mezz'ora a [url=https://store.steampowered.com/app/881100]Noita[/url].", check=CheckPlayedSteamGame(881100), @@ -34,7 +34,7 @@ trionfilist = ( title="iii", roman="III", name="L'Imperatrice", - puzzle="NON IMPEGNARTI", + puzzle="RIMANI LIBERO", objective="Gioca almeno mezz'ora [url=https://store.steampowered.com/app/245170]Skullgirls[/url].", check=CheckPlayedSteamGame(245170), ), @@ -43,7 +43,7 @@ trionfilist = ( title="iv", roman="IV", name="L'Imperatore", - puzzle="ESEGUI GLI ORDINI", + puzzle="ESEGUI QUESTI ORDINI", objective="Vinci una partita su [url=https://store.steampowered.com/app/611500]Quake Champions[/url].", check=CheckAchievementSteamGame(611500, "qc_victory") ), @@ -70,6 +70,9 @@ trionfilist = ( 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[" + "/url].", + check=CheckPlayedSteamGame(326460, "play5") ), TrionfoInfo( variable="viii", @@ -87,25 +90,33 @@ trionfilist = ( roman="IX", name="L'Eremita", puzzle="SEGRETAMENTE", + objective="Sconfiggi tutti i boss del Basement almeno una volta su [" + "url=https://store.steampowered.com/app/250900]The Binding " + "of Isaac: Rebirth[/url].", + check=CheckAchievementSteamGame(250900, "13"), ), TrionfoInfo( variable="x", title="x", roman="X", name="La Fortuna", - puzzle="LA CASA DEI GIOCHI" + puzzle="LA CASA DEI GIOCHI", + objective="Chiedi a Royal Bot di predire il tuo futuro.", + check=None, ), TrionfoInfo( variable="xi", title="xi", roman="XI", name="La Forza", + puzzle="PORTA STRUMENTI DI CONTROLLO" ), TrionfoInfo( variable="xii", title="xii", roman="XII", name="L'Appeso", + puzzle="PREPARA LA CORDA ELETTRICA", objective="Gioca almeno mezz'ora a [url=https://store.steampowered.com/app/381210]Dead by " "Daylight.[/url]", check=CheckPlayedSteamGame(381210), @@ -115,21 +126,25 @@ trionfilist = ( title="xiii", roman="XIII", name="La Morte", - objective="Raggiungi la Tenuta dell'Antenato su [url=https://store.steampowered.com/app/262060]Darkest Dungeon[" - "/url].", - check=CheckAchievementSteamGame(262060, "welcome_home"), + objective="Completa la campagna Dead Center di [url=]Left 4 Dead 2[/url].", + check=CheckAchievementSteamGame(550, "ACH_SURVIVE_MALL"), ), TrionfoInfo( variable="xiv", title="xiv", roman="XIV", name="La Temperanza", + objective="Raggiungi la Tenuta dell'Antenato su [url=https://store.steampowered.com/app/262060]Darkest Dungeon[" + "/url].", + check=CheckAchievementSteamGame(262060, "welcome_home"), ), TrionfoInfo( variable="xv", title="xv", roman="XV", name="Il Diavolo", + objective="Completa la prima missione di [url=https://store.steampowered.com/app/379720]DOOM[/url]." + # DOOM E1M1 https://steamcommunity.com/stats/379720/achievements/ ), TrionfoInfo( variable="xvi", @@ -146,13 +161,16 @@ trionfilist = ( title="xvii", roman="XVII", name="Le Stelle", + objective="Completa due missioni co-op online su [" + "url=https://store.steampowered.com/app/630/Alien_Swarm]Alien Swarm[/url].", + check=CheckAchievementSteamGame(630, "ASW_PARA_HAT"), ), TrionfoInfo( variable="xviii", title="xviii", roman="XVIII", name="La Luna", - objective="Gioca a [url=https://store.steampowered.com/app/388880]Oxenfree[/url].", + objective="Gioca almeno mezz'ora a [url=https://store.steampowered.com/app/388880]Oxenfree[/url].", check=CheckPlayedSteamGame(388880), ), TrionfoInfo( @@ -160,6 +178,8 @@ trionfilist = ( title="xix", roman="XIX", name="Il Sole", + objective="Gioca almeno mezz'ora a [url=https://store.steampowered.com/app/420530]OneShot[/url].", + check=CheckPlayedSteamGame(420530), ), TrionfoInfo( variable="xx",