def create_action_manager(fetcher, start, end): action_manager = ActionManager() VERBOSE("Fetching paths and titles of pages.") fetcher.FeedFetchSpecial("ga:pagePath,ga:pageTitle", "ga:pageviews", start, end) for act in fetcher.FeedToDict(): action_manager.add_action(act["ga:pagePath"], act["ga:pageTitle"]) return action_manager
class Help(Action): manager = ActionManager.getInstance() def execute(self): print("Actions possibles : ") Help.manager.descriptionCommande() input() def description(self): return "Permet au joueur d'avoir la description des commandes disponibles" def getType(self): return self.getCategories()[1]
from action import Action, ActionManager from catalogue import Catalogue class CatalogueAction(Action): def __init__(self, catalogue): self.catalogue = catalogue def execute(self, param): index = 1 for doc in self.catalogue.getDocument(): print(str(index) + ": " + doc.getTitre()) index += 1 def info(self): return "Consulter le catalogue" def help(self): return "Consulte le catalogue, ne prend aucun paramètre" ActionManager.getInstance().registerCommand( "cat", CatalogueAction(Catalogue.getInstance()))
from action import ActionManager from actions.nord import Nord class NordCommand(ActionManager): def execute(self): return Nord().execute() def description(self): return Nord().description() def getType(self): return Nord().getType() ActionManager.getInstance().registerCommand("z", NordCommand())
from action import Action, ActionManager from etatApp import EtatApp class QuitterAction(Action): def execute(self, param): EtatApp.getInstance().terminerApp() def info(self): return "Quitter" def help(self): return """Quitte l'application, ne prend aucun paramètre""" ActionManager.getInstance().registerCommand("quit", QuitterAction())
from action import ActionManager from actions.help import Help class HelpCommand(ActionManager): def execute(self): return Help().execute() def description(self): return Help().description() def getType(self): return Help().getType() ActionManager.getInstance().registerCommand("help", HelpCommand())
potionRate = 30 redbullRate = 15 l = Labyrinthe.getInstance(30, 20) else: joueur = Joueur.getInstance("👤", "X", 55) monsterSpawnRate = 8 potionRate = 25 redbullRate = 10 l = Labyrinthe.getInstance(30, 30) l.deposerJoueurAleatoirement(joueur) factoryObjet = ObjetFactoryPrincipale.getInstance() factoryObjet.loadFactoryPlugins() factoryPersonne = PersonnesFactoryPrincipale.getInstance() factoryPersonne.loadFactoryPlugins() actionManager = ActionManager.getInstance() actionManager.loadActionPlugins() # Generation de 35 potions aléatoirement for i in range(potionRate): l.deposerObjetAleatoirement(factoryObjet.creerObjet("potion"), joueur) for i in range(redbullRate): l.deposerObjetAleatoirement(factoryObjet.creerObjet("redbull"), joueur) for i in range(12): l.deposerObjetAleatoirement(factoryObjet.creerObjet("clef"), joueur) # Ajouter des perroquets un peu partout for i in range(15): l.deposerPersonneAleatoirement(factoryPersonne.creerPersonne("perroquet"),
from action import ActionManager from actions.regarder import Regarder class RegarderCommand(ActionManager): def execute(self): return Regarder().execute() def description(self): return Regarder().description() def getType(self): return Regarder().getType() ActionManager.getInstance().registerCommand("regarder", RegarderCommand())
from action import ActionManager from actions.est import Est class EstCommand(ActionManager): def execute(self): return Est().execute() def description(self): return Est().description() def getType(self): return Est().getType() ActionManager.getInstance().registerCommand("d", EstCommand())
from action import ActionManager from actions.sud import Sud class SudCommand(ActionManager): def execute(self): return Sud().execute() def description(self): return Sud().description() def getType(self): return Sud().getType() ActionManager.getInstance().registerCommand("s", SudCommand())
def get_action_manager(self): if self._action_manager is None: self._action_manager = ActionManager(self) return self._action_manager
from action import ActionManager from actions.parler import Parler class parlerCommand(ActionManager): def execute(self): return Parler().execute() def description(self): return Parler().description() def getType(self): return Parler().getType() ActionManager.getInstance().registerCommand("parler", parlerCommand())
from action import Action, ActionManager from catalogue import Catalogue class AfficherAction(Action): def __init__(self, catalogue): self.catalogue = catalogue def execute(self, param): # Afficher un document docNum = int(param) print(self.catalogue.getDocument()[docNum - 1].consulter()) def info(self): return "Consulter un document particulier" def help(self): return """Affiche un document du catalogue Paramètres : un entier qui correspond au numéro du document à afficher Attention, ne pas taper autre chose qu'un entier sinon ça plante ! """ ActionManager.getInstance().registerCommand("show",AfficherAction(Catalogue.getInstance()))
from action import ActionManager from actions.ramasser import Ramasser class RamasserCommand(ActionManager): def execute(self): return Ramasser().execute() def description(self): return Ramasser().description() def getType(self): return Ramasser().getType() ActionManager.getInstance().registerCommand("ramasser", RamasserCommand())
from action import ActionManager from actions.sac import Sac class SacCommand(ActionManager): def execute(self): return Sac().execute() def description(self): return Sac().description() def getType(self): return Sac().getType() ActionManager.getInstance().registerCommand("sac", SacCommand())
from action import ActionManager from actions.ouest import Ouest class OuestCommand(ActionManager): def execute(self): return Ouest().execute() def description(self): return Ouest().description() def getType(self): return Ouest().getType() ActionManager.getInstance().registerCommand("q", OuestCommand())