def outro_alt():
    sleep(2)
    print(
        chalk.yellow('''


                 ██████╗  █████╗ ███╗   ███╗███████╗
                ██╔════╝ ██╔══██╗████╗ ████║██╔════╝
                ██║  ███╗███████║██╔████╔██║█████╗  
                ██║   ██║██╔══██║██║╚██╔╝██║██╔══╝  
                ╚██████╔╝██║  ██║██║ ╚═╝ ██║███████╗
                 ╚═════╝ ╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝
                  ██████╗ ██╗   ██╗███████╗██████╗ 
                 ██╔═══██╗██║   ██║██╔════╝██╔══██╗
                 ██║   ██║██║   ██║█████╗  ██████╔╝
                 ██║   ██║╚██╗ ██╔╝██╔══╝  ██╔══██╗
                 ╚██████╔╝ ╚████╔╝ ███████╗██║  ██║
                  ╚═════╝   ╚═══╝  ╚══════╝╚═╝  ╚═╝
    '''))
    s.sound_effect('audio/ending_theme_short.wav')
    print(
        chalk.yellow('''
                                         ...or is it?
    '''))
    sleep(2)
    print(chalk.green("\tWould you like to see the alternate ending? y/n"))
    ending = input("> ")
    if ending == 'y':
        alt()
Beispiel #2
0
 def on_any_event(self, event):
     if event.is_directory:
         return
     ext = os.path.splitext(event.src_path)[1]
     if ext == '.py':
         self.process = self.restart()
         chalk.eraser()
         chalk.yellow("Detected changes, restarting...")
Beispiel #3
0
 def on_any_event(self, event):
     if event.is_directory:
         return
     ext = os.path.splitext(event.src_path)[1]
     if ext == '.py':
         self.schedule_restart()
         chalk.eraser()
         chalk.yellow("Detected changes in {}, restarting...".format(event.src_path))
Beispiel #4
0
 def on_any_event(self, event):
     if event.is_directory:
         return
     ext = os.path.splitext(event.src_path)[1]
     if ext == ".py":
         self.process = self.restart()
         chalk.eraser()
         chalk.yellow("Detected changes, restarting...")
Beispiel #5
0
 def on_any_event(self, event):
     if event.is_directory:
         return
     ext = path(event.src_path).ext
     if ext == '.py':
         self.process = self.restart()
         chalk.eraser()
         chalk.yellow("Detected changes, restarting...")
Beispiel #6
0
    async def on_command(self, ctx):
        botguild = next((item for item in self.bot.guilds if item.id == 615228970568515626), None)
        log = botguild.get_channel(625767405641007106)
        try:
            print(chalk.bold(chalk.cyan(f'{ctx.guild.name}')) + chalk.yellow(' > ') + chalk.bold(
                chalk.green(f'{ctx.author}')) + chalk.yellow(': ') + f'{ctx.message.clean_content}')
            await log.send(f'```md\n[{ctx.guild.name}]({ctx.channel.name}) {ctx.author}: {ctx.message.clean_content}```')

        except AttributeError:
            print(chalk.yellow(f"Private message > {ctx.author} > {ctx.message.clean_content}"))
            await log.send(f'```md\n< Private message > {ctx.author}: {ctx.message.clean_content}```')
Beispiel #7
0
def import_tasks():
    for app in TASK_PATHS:
        if not app.split('.')[-1] == 'tasks':
            module = importlib.import_module(app)
            filename = os.path.join(module.__path__[0], 'tasks.py')
            if not os.path.isfile(filename):
                chalk.yellow(app + ' does not have a tasks module.')
                continue
            else:
                app = app + '.tasks'

        chalk.blue(app.upper() + ': imported tasks from %s' % app)
        importlib.import_module(app)
Beispiel #8
0
def import_tasks():
    for app in TASK_PATHS:
        if not app.split('.')[-1] == 'tasks':
            module = importlib.import_module(app)
            filename = os.path.join(module.__path__[0], 'tasks.py')
            if not os.path.isfile(filename):
                chalk.yellow(app + ' does not have a tasks module.')
                continue
            else:
                app = app + '.tasks'

        chalk.blue(app.upper() + ': imported tasks from %s' % app)
        importlib.import_module(app)
def display_ballot(candidates):
    """
    Prints the ballot dict.  Uses dict() 1.
    
    :param candidates: dict
    :return: None
    """

    print('Here are your candidates for President of the Gecko Federation: ',
          end='\n')

    for index, key in enumerate(candidates, start=1):
        chalk.yellow(str(index) + '------> ' + key)
Beispiel #10
0
def import_tasks():
    for app in TASK_PATHS:
        if not app.split(".")[-1] == "tasks":
            module = importlib.import_module(app)
            filename = os.path.join(module.__path__[0], "tasks.py")
            if not os.path.isfile(filename):
                chalk.yellow(app + " does not have a tasks module.")
                continue
            else:
                app = app + ".tasks"

        chalk.blue(app.upper() + ": imported tasks from %s" % app)
        importlib.import_module(app)
Beispiel #11
0
 def getPluginVersion(self, info, name):
     try:
         for plugin in Config.AJAX_TELEMETRY['glpi']['plugins']:
             if plugin['key'] == name:
                 print(
                     chalk.white('\t[+] Version of [', bold=True) +
                     chalk.yellow(info[1], bold=True) +
                     chalk.white('] : [', bold=True) +
                     chalk.yellow(plugin['version'], bold=True) +
                     chalk.white(']', bold=True))
                 return plugin['version']
     except:
         return False
Beispiel #12
0
def add(phonebook):                                                 # Add to phonebook
    """
    {'name': 'Kieran', 'number': 8456331959, 'phrase': 'Good code is not written, it\'s re-written.'}
    :return: dictionary user entry, added to larger phone book list
    """
    person_entry = dict()

    user = input("Enter first name. >> ")
    last = input("Enter last name? >> ")
    phone = input("Enter phone number? >> ")

    person_entry.update({'First Name': user.capitalize(), 'Last Name': last.capitalize(), 'Phone': phone})
    phonebook.append(person_entry)
    chalk.yellow(f"{user} has been added to the phone book.")
Beispiel #13
0
def show(proj_name, task_name):
	try:
		with open(IDEA_CONFIG_FILE_PATH, 'r') as f:
			data = f.read()
			data = decryption(data)
			data = json.loads(data)
		f.close()
	except:
		chalk.red("File not exist, operation aborted.")
		return
	for proj, task in data.items():
		chalk.yellow(proj)
		for task, desc in task:
			chalk.cyan('\t' + task)
			chalk.cyan('\t\t' + desc)
 def shields(self, shield_level):
     if shield_level == 100:
         return chalk.green(f"Shields: {shield_level}%")
     if shield_level > 20:
         return chalk.yellow(f"Shields: {shield_level}%")
     else:
         return chalk.red(f"Shields: {shield_level}%")
Beispiel #15
0
def run_task(task, thread):
    try:
        task = Task.rehydrate(task)
        chalk.yellow('%r STARTING: %s' % (thread, task.key))
        with CaptureStdOut(task=task) as output:
            try:
                task.run()
            except:
                print traceback.format_exc()
                task.finish(traceback.format_exc())

        output.finished()
        thread.active_task = None
    except AttributeError as e:
        thread.active_task = None
        print traceback.format_exc()
 async def restart(self,ctx):
     embed = discord.Embed(title = "Give me a moment to restart...",color = conf.norm)
     await ctx.send(embed=embed)
     await self.b.change_presence(status=discord.Status.idle)
     print(chalk.yellow("A developer has restarted the bot!"))
     print("\n")
     subprocess.call([sys.executable, "maid.py"])
Beispiel #17
0
def run_task(task, thread):
    try:
        task = Task.rehydrate(task)
        chalk.yellow('%r STARTING: %s' % (thread, task.key))
        with CaptureStdOut(task=task) as output:
            try:
                task.run()
            except:
                print traceback.format_exc()
                task.finish(traceback.format_exc())

        output.finished()
        thread.active_task = None
    except AttributeError as e:
        thread.active_task = None
        print traceback.format_exc()
    async def on_command_error(self, ctx, error):

        if hasattr(ctx.command, 'on_error'):
            return

        error = getattr(error, 'original', error)

        if isinstance(error, commands.DisabledCommand):
            print(chalk.red(f"{ctx.command} is disabled with the command deco"))

        elif isinstance(error, commands.CommandNotFound):
            return
 
        elif isinstance(error, checks.blank):
            return

        elif isinstance(error, commands.MissingPermissions):
            await ctx.send("Sorry, but you don't have permission to use this command. You might need to ask the Club Leader to switch this. (PS! You need Admin to use this command!)")

        else:
            tra = traceback.format_exception_only(type(error), error)
            e = discord.Embed(description="`Oops! That's not supposed to happen, here's the traceback below.` ```py\n%s\n``` \nLooks like you encountered an issue! If you want, you can report this by clicking [here!](https://forms.gle/hJ3KHVwKMFzfs5eq9) (It takes you to a form where you can explain the bug in detail.)" % ''.join(tra), file=sys.stderr, color=conf.err)
            e.set_author(name="That's an issue!",icon_url=ctx.message.author.avatar_url)
            e.set_footer(text="v"+ver)
            await ctx.send(embed=e)
            print(chalk.yellow(f"Warning! The command '{ctx.command}' has just Errored!")) 
            print(chalk.red(f"Traceback: %s" % ''.join(tra)))
Beispiel #19
0
async def start(onBind, c):
    global config
    config = c

    import logging
    logger = logging.Logger("server")
    logger.setLevel(logging.DEBUG)

    # Create an app and a runner
    app = web.Application()
    app.add_routes([web.post("/fromGitlab", fromGitlab)])
    app.add_routes([web.post("/fromNest", fromNest)])
    runner = web.AppRunner(app, logger=logger)
    await runner.setup()

    site, port = await start_somewhere(runner)
    cur_ip = await get("https://api.ipify.org")
    await onBind(f"{cur_ip}:{port}")

    print(chalk.green(chalk.bold("  Initialization finished!")))

    # Listen for IP changes
    while True:
        await asyncio.sleep(5)
        ip = await get("https://api.ipify.org")
        if ip != cur_ip:
            print(
                chalk.yellow(
                    f"IP changed from {cur_ip} to {ip}, restarting server..."))
            await site.stop()
            site, port = await start_somewhere(runner)
            cur_ip = ip
            await onBind(f"{cur_ip}:{port}")
Beispiel #20
0
async def syncPijulToGitPatch(branch, git, pijul, action, patch_id, author,
                              timestamp, message):
    small_patch_id = patch_id[:10] + "..."
    if action == "add":
        print(f"  Syncing new patch {small_patch_id}: {message}")
        await run(f"cd {pijul}; pijul apply {patch_id} --branch {branch}")
    elif action == "remove":
        print(f"  Reverting patch {small_patch_id}: {message}")
        await run(f"cd {pijul}; pijul unrecord {patch_id} --branch {branch}")

    await run(f"cd {pijul}; pijul revert --all --branch {branch}")

    # Synchronize
    await run(f"rsync -rv -f'- .git/' -f'- .pijul/' {pijul}/ {git}/")

    # Commit
    is_empty = (await run(f"cd {git}; git status --short")).strip() == ""

    if action == "add":
        message = shlex.quote(
            f"{message}\n\nImported from Pijul patch {patch_id}")
    elif action == "remove":
        message = shlex.quote(f"{message}\n\nReverted Pijul patch {patch_id}")
    author = shlex.quote(author)
    date = str(timestamp)
    await run(
        f"cd {git}; git add --all; git commit --author={author} --date='{date}' --message={message} --no-edit --allow-empty"
    )
    commit = (await run(f"cd {git}; git rev-parse HEAD")).strip()

    if is_empty:
        print(chalk.yellow(f"  No changes (fast-forward), committed {commit}"))
    else:
        print(chalk.green(f"  Done. Committed {commit}"))
Beispiel #21
0
 def check_results(self):
     print(
         f"::set-output name=has_updated_sources::{str(self.has_updated_sources)}"
     )
     if self.status == "success":
         logging.info(
             c.green("✅ Successfully linted all files without errors"))
         config.delete()
     elif self.status == "warning":
         logging.warning(
             c.yellow(
                 "◬ Successfully linted all files, but with ignored errors")
         )
         config.delete()
     else:
         logging.error(c.red("❌ Error(s) have been found during linting"))
         logging.warning(
             "To disable linters or customize their checks, you can use a .mega-linter.yml file "
             "at the root of your repository")
         logging.warning(f"More info at {ML_DOC_URL}/configuration/")
         if self.cli is True:
             if config.get("DISABLE_ERRORS", "false") == "true":
                 config.delete()
                 sys.exit(0)
             else:
                 config.delete()
                 sys.exit(self.return_code)
         config.delete()
Beispiel #22
0
def process_test_branch(PUSH_URI, test_branch_name, cwd, no_push_uri=False):
    branch_name = get_branch_name(test_branch_name)
    feature_branch_name = 'feature/' + branch_name

    # CAUTION: using cwd inside run_command

    with settings(warn_only=True):
        run_result = run_command(
            'git clone  -b {} {} .'.format(test_branch_name, PUSH_URI), cwd)

        if (run_result.failed == ERR_DRY_RUN_EXPLAIN):
            print(chalk.yellow(ERR_DRY_RUN_EXPLAIN))

        elif run_result.failed:
            print(chalk.red(GIT_ERR_128_EXPLAIN))
            raise GIT_ERR_128_EXPLAIN
        else:
            pass

    merge_to_feature_branch(test_branch_name, feature_branch_name, cwd)

    if no_push_uri:
        print('no pushing commit as no_push_uri is true')
    else:
        push_commit(PUSH_URI, feature_branch_name, cwd)
Beispiel #23
0
    def warning(self, name: str = "Main Process", output: str = None):
        if output is None:
            return print(
                chalk.red(
                    f"{time.strftime('%c')} - [{name}]: No output provided!"))

        print(chalk.yellow(f"{time.strftime('%c')} - [{name}]: {output}"))
Beispiel #24
0
    async def avi(ctx, name=""):
        """View a bigger version of a user's pfp."""
        if name:
            try:
                user = ctx.message.mentions[0]
            except IndexError:
                user = ctx.guild.get_member_named(name)
            if not user:
                user = ctx.guild.get_member(int(name))
            if not user:
                user = dozbot.get_user(int(name))
            if not user:
                user = await dozbot.fetch_user(int(name))
            if not user:
                return await ctx.send('Could not find user.')
        else:
            user = ctx.message.author

        avi = user.avatar_url_as(static_format='png')
        em = discord.Embed(colour=RandomColour())
        em.set_image(url=avi)

        try:
            await ctx.send(embed=em)
        except:
            print(chalk.yellow("[NOTICE] CMD|PFP: Couldn't send embed."))
            dozbot_logs_webhook.send(
                "```[NOTICE] CMD|PFP: Couldn't send embed.```")

        try:
            return await ctx.message.delete()
        except:
            return
    async def on_ready(self):  #When the bot is ready
        print("\n")
        print(chalk.green(f"[SUCCESS] Connected to Discord as: {self.b.user}"))
        if conf.sharding is False:  #If sharding is disabled
            print(chalk.red(f"[WARNING] Sharding: Disabled"))
        elif conf.sharding is True:  #If sharding is Enabled
            print(chalk.green("[INFO] Sharding: Enabled"))
            print(chalk.yellow(f"[INFO] Using SHARD's {self.b.shard_ids}")
                  )  #Shows us how many shards we are currently using

        print(chalk.cyan(f"[INFO] Config name: '{conf.name}'")
              )  #Shows us the name defined in the config
        print(
            chalk.cyan(
                f"[INFO] Default Prefix: 'Prefix 1: {conf.prefix1} | Prefix 2: {conf.prefix2}'"
            ))  #Shows us the 2 prefixes defined in the config
        print(chalk.cyan("[INFO] Are you braindead: Most Likely"))  #Yup
        print(
            chalk.cyan(
                f"[INFO] I'm currently in [{len(self.b.guilds)}] server(s).")
        )  #Shows us how many servers we are in
        aaa = True
        for guild in self.b.guilds:  #Set all guild the doki is in to have triggers enabled on startup otherwise they no be in list which means triggers are off.
            conf.w_tog_on.insert(0, guild.id)
        while aaa:  #A loop to make the game activity change every 900 seconds
            for list in conf.playing_msg:
                await self.b.change_presence(activity=discord.Game(name=list))
                await asyncio.sleep(900)
def move_enemies(world):
    # Moving enemies around the board, if chosen direction is empty or hero, action is taken, otherwise they don't mainLoop.
    # Build list of enemies first then mainLoop them one at a time
    move_tuples = [(1, 0), (0, 1), (-1, 0), (0, -1)]
    enemies = world.get_enemies()
    for enemy in enemies:
        current_location = enemy.get_location()
        while True:
            choice = random.choice(move_tuples)
            next_location = (current_location[0] + choice[0],
                             current_location[1] + choice[1])
            if 0 < next_location[0] <= world.get_rows(
            ) and 0 < next_location[1] <= world.get_columns():
                break
        if isinstance(world[next_location], Empty):
            world[next_location] = enemy
            enemy.update_location(next_location)
            world[current_location] = Empty('empty', current_location, True)
        elif world[next_location] == hero:
            print_image(enemy.get_kind() + '.txt')
            print(
                chalk.red(
                    f"Look out! You are being attacked by a {enemy.get_kind()} "
                    f"armed with a {enemy.get_weapon()}"))
            print(chalk.yellow("Here are it's stats..."))
            print(chalk.green(enemy))
            world[current_location] = battle(enemy)
    return
 def initPlugin(self, info):
     version = AjaxTelemetry().getPluginVersion(info, 'officeonline')
     if version:
         Exploits().verifExploit(info[1], version)
     else:
         print(
             chalk.white('\t[-] Version not found : ', bold=True) +
             chalk.yellow(Config.GLPI_URL + info[0], bold=True))
Beispiel #28
0
def copy_dir_contents(src, dst, ignore=IGNORE):
    "Copies all folders and files under src directory to dst"
    for f in os.listdir(src):
        if f in ignore:
            chalk.yellow("Ignoring {0}".format(f))
            continue

        fpath = os.path.join(src, f)
        dst_path = os.path.join(dst, f)

        if os.path.isdir(fpath):
            if not os.path.exists(dst_path):
                os.mkdir(dst_path)
            chalk.green("Copying '{0}' and its contents to '{1}'".format(f, dst))
            copy_dir_contents(fpath, dst_path, ignore)
        else:
            chalk.green("Copying file '{0}' to '{1}'".format(f, dst))
            shutil.copy(fpath, dst)
Beispiel #29
0
 def __str__(self):
     cell = "[{0:03d}] ".format(self.value)
     if self.start:
         return chalk.green(cell)
     elif self.current:
         return chalk.red(cell)
     elif self.visited:
         return chalk.yellow(cell)
     return cell
Beispiel #30
0
 def getVersion(self, info):
     if Config.DEBUG:
         print("[DEBUG] GET : " + Config.GLPI_URL + info[0])
     r = requests.get(Config.GLPI_URL + info[0],
                      verify=False,
                      proxies=Config.PROXY,
                      headers=Config.HEADERS)
     content = r.content.decode("utf-8")
     if content.find('<num>') != -1:
         version = content[content.find('<num>') + len('<num>'):]
         version = version[:version.find('<')]
         print(
             chalk.white('\t[+] Version of [', bold=True) +
             chalk.yellow(info[1], bold=True) +
             chalk.white('] : [', bold=True) +
             chalk.yellow(version, bold=True) + chalk.white(']', bold=True))
         return version
     return False
Beispiel #31
0
 def getPlugin(self, plugin):
     if Config.DEBUG:
         print("[DEBUG] GET : " + Config.GLPI_URL + plugin[0])
     pluginfolder = "/".join(plugin[0].split("/", 3)[:3]) 
     r = requests.get(Config.GLPI_URL + pluginfolder, verify=False, proxies=Config.PROXY, headers=Config.HEADERS, allow_redirects=False)
     if (r.status_code == 301):
         print(chalk.white('\n[+] Plugin [', bold=True) + chalk.yellow(plugin[1], bold=True) + chalk.white('] found !', bold=True))
         obj = ImportPlugin().importModule(plugin[3])
         obj.initPlugin(plugin)
Beispiel #32
0
 def listFolder(self, folder):
     if Config.DEBUG:
         print("[DEBUG] GET : " + folder)
     r = requests.get(folder, verify=False, proxies=Config.PROXY, headers=Config.HEADERS)
     contents = re.findall(r'<td><a href=\".*?\"', r.content.decode('utf-8'))
     for content in contents[1:]:
         content = content[content.find('"')+len('"'):]
         content = content[:content.find("\"")]
         print(chalk.white('\t[+] : ', bold=True) + chalk.yellow(folder + content, bold=True))
Beispiel #33
0
def warn(msg, **kwargs):
    output = [ currenttime(), chalk.yellow("WARN"), msg ]
    output += [ "{}={}".format(chalk.blue(key), val) for key, val in kwargs.items() ]
    output = " ".join(output)

    with open(LOG, "a") as f:
        f.write(output + "\n")

    print(output)
Beispiel #34
0
def copy_dir_contents(src, dst, ignore=IGNORE):
    "Copies all folders and files under src directory to dst"
    for f in os.listdir(src):
        if f in ignore:
            chalk.yellow("Ignoring {0}".format(f))
            continue

        fpath = os.path.join(src, f)
        dst_path = os.path.join(dst, f)

        if os.path.isdir(fpath):
            if not os.path.exists(dst_path):
                os.mkdir(dst_path)
            chalk.green("Copying '{0}' and its contents to '{1}'".format(
                f, dst))
            copy_dir_contents(fpath, dst_path, ignore)
        else:
            chalk.green("Copying file '{0}' to '{1}'".format(f, dst))
            shutil.copy(fpath, dst)
 def initPlugin(self, info):
     version = AjaxTelemetry().getPluginVersion(info, 'cleanarchivedemails')
     if not version:
         version = self.getVersion(info)
     if version:
         Exploits().verifExploit(info[1], version)
     else:
         print(
             chalk.white('\t[-] Version not found : ', bold=True) +
             chalk.yellow(Config.GLPI_URL + info[0], bold=True))
def battle(good_guy, bad_guy):
    bad_guy_name = bad_guy.get_kind().title()
    good_guy_name = good_guy.get_kind().title()

    print(chalk.green(f"You are attacking a {bad_guy.get_kind()}, armed with a {bad_guy.get_weapon()}"))
    print(chalk.green("here are it's stats..."))
    print(chalk.green(bad_guy))
    ans = answer_question('Would you like to attack or run away (a/r)?', ['a', 'r'])
    while ans == 'a':
        rps_dictionary = {'r': 'rock', 'p': 'paper', 's': 'scissors'}
        ans = answer_question('Choose rock, paper, or scissors (r/p/s)', ['r', 'p', 's'])
        good_guy_choice = rps_dictionary[ans]
        bad_guy_choice = random.choice(['rock', 'paper', 'scissors'])

        print(chalk.green(f'You chose {good_guy_choice} and the enemy chose {bad_guy_choice}'))
        if bad_guy_choice == good_guy_choice:
            print(chalk.green("It's a tie! Do over!"))
        elif bad_guy_choice == 'rock' and good_guy_choice == 'paper':
            print(chalk.green("You've struck a blow! Good job!"))
            bad_guy.update_health(-1 * good_guy.get_attack_power())
        elif bad_guy_choice == 'paper' and good_guy_choice == 'scissors':
            print(chalk.green("You've struck a blow! Good job!"))
            bad_guy.update_health(-1 * good_guy.get_attack_power())
        elif bad_guy_choice == 'scissors' and good_guy_choice == 'rock':
            print(chalk.green("You've struck a blow! Good job!"))
            bad_guy.update_health(-1 * good_guy.get_attack_power())
        elif bad_guy_choice == 'scissors' and good_guy_choice == 'paper':
            print(chalk.red("You've taken a hit. Ouch!"))
            good_guy.update_health(-1 * bad_guy.get_attack_power())
        elif bad_guy_choice == 'paper' and good_guy_choice == 'rock':
            print(chalk.red("You've taken a hit. Ouch!"))
            good_guy.update_health(-1 * bad_guy.get_attack_power())
        elif bad_guy_choice == 'rock' and good_guy_choice == 'scissors':
            print(chalk.red("You've taken a hit. Ouch!"))
            good_guy.update_health(-1 * bad_guy.get_attack_power())

        if hero.get_health() <= 0:
            print_image('died_in_battle.txt')
            return good_guy, bad_guy
        elif bad_guy.get_health() <= 0:
            print_image('won_the_battle.txt')
            return good_guy, Thing(bad_guy.get_weapon(), bad_guy.get_location(), False, False)

        battle_status = good_guy_name + ': ' + str(good_guy.get_health()) + '  vs.  ' + bad_guy_name + ': ' \
                        + str(bad_guy.get_health())
        if good_guy.get_health() > 35:
            print(chalk.green(battle_status))
        elif good_guy.get_health() > 10:
            print(chalk.yellow(battle_status))
        else:
            print(chalk.red(battle_status))

        ans = answer_question('Would you like to attack or run away (a/r)?', ['a', 'r'])

    return hero, bad_guy
def print_board(world):
    update_board_visibility(world)
    print(world)
    if hero.get_health() > 35:
        print(chalk.green(hero))
    elif hero.get_health() > 10:
        print(chalk.yellow(hero))
    else:
        print(chalk.red(hero))
    time.sleep(2)
    return
Beispiel #38
0
#!/usr/bin/env python

import chalk

chalk.red("Hello world!!")
chalk.yellow("This looks like a warning...")
chalk.cyan('...more formatting', opts=('bold', 'underscore'))
Beispiel #39
0
#!/usr/bin/env python

import chalk

chalk.blue("Hello world!!")
chalk.yellow("Listen to me!!!")
chalk.red("ERROR", pipe=chalk.stderr)
chalk.magenta('This is pretty cool', opts='bold')
chalk.cyan('...more stuff', opts=('bold', 'underscore'))