Ejemplo n.º 1
0
def search_room(alias):
    """ Look for rooms with substr search """
    results = mapdata.search_room_substring(alias.suffix.lower().strip())
    header = "{:<12s}{:<68s}"
    echo(header.format("ID", "Room Name"))
    echo(ansi.strfcolor("%g{:-<80}%0".format("")))
    for room in results:
        fmt = "{:<12d}{:<68s}"
        echo(fmt.format(room, mapdata.rooms[room]['name']))
Ejemplo n.º 2
0
    def render_balance(self):
        """ Color balances with a green/red background. """

        if 'e' in self.stats and 'x' in self.stats:
            return ansi.strfcolor("%W&gex%0")

        statout = "%W&r"

        if 'e' in self.stats:
            statout += 'e'
        else:
            statout += ' '

        if 'x' in self.stats:
            statout += 'x'
        else:
            statout += ' '

        return ansi.strfcolor(statout + "%0")
Ejemplo n.º 3
0
    def render_balance(self):
        """ Color balances with a green/red background. """

        if 'e' in self.stats and 'x' in self.stats:
            return ansi.strfcolor("%W&gex%0")

        statout = "%W&r"

        if 'e' in self.stats:
            statout += 'e'
        else:
            statout += ' '

        if 'x' in self.stats:
            statout += 'x'
        else:
            statout += ' '

        return ansi.strfcolor(statout + "%0")
Ejemplo n.º 4
0
    def render(self):
        """ The overrided render() method for the PromptRenderer class. """

        data = {
            'health': self.colorize_vital(player.health.percentage),
            'mana': self.colorize_vital(player.mana.percentage),
            'willpower': self.colorize_vital(player.willpower.percentage),
            'endurance': self.colorize_vital(player.endurance.percentage),
            'balance': self.render_balance(),
            'stats': self.render_stats()
        }

        fstr = "%-[{health}%-%]h [{mana}%-%]m {willpower}%-%%w {endurance}%-%e {balance}|{stats}%0-"

        return ansi.strfcolor(fstr).format(**data)
Ejemplo n.º 5
0
    def render(self):
        """ The overrided render() method for the PromptRenderer class. """

        data = {
            'health': self.colorize_vital(player.health.percentage),
            'mana': self.colorize_vital(player.mana.percentage),
            'willpower': self.colorize_vital(player.willpower.percentage),
            'endurance': self.colorize_vital(player.endurance.percentage),
            'balance': self.render_balance(),
            'stats': self.render_stats()
        }

        fstr = "%-[{health}%-%]h [{mana}%-%]m {willpower}%-%%w {endurance}%-%e {balance}|{stats}%0-"

        return ansi.strfcolor(fstr).format(**data)