Esempio 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']))
Esempio 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")
Esempio 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")
Esempio 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)
Esempio 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)