Ejemplo n.º 1
0
    def func(self, invoker, parsed_cmd):
        bridge = invoker.location
        ship = bridge.get_ship_obj()
        solar_system = ship.get_solar_system_obj()

        if ship.is_ship_landed():
            raise CommandError("What contacts? You aren't in space.")

        buf = self._get_header_str("Contacts near %s" % ship.location.get_appearance_name(invoker))
        for contact in ship.get_visible_contacts():
            shield_bar, shield_perc, shield_color = progress_bar_str(
                12, contact.get_max_shield_hp(), contact.get_current_shield_hp())
            hull_bar, hull_perc, hull_color = progress_bar_str(
                12, contact.get_max_hull_hp(), contact.get_current_hull_hp())
            standing_val = contact.check_ship_standing(ship)
            standing_str, standing_color = get_standing_value_cosmetics(standing_val)
            status_flags = self._get_short_status_flags(contact)

            buf += (
                "\n {standing_color}{id:>5}]{ship_class_code:<1}  {ship_reference:<10} "
                "{display_name:<20} S:{shield_bar} H:{hull_bar}  "
                "S:{status_flags}{escape_color}".format(
                    standing_color=standing_color,
                    id=contact.id,
                    ship_class_code=contact.ship_class_code,
                    ship_reference=contact.ship_reference,
                    display_name=contact.display_name,
                    shield_bar=shield_bar,
                    hull_bar=hull_bar,
                    status_flags=status_flags,
                    escape_color=ANSI_NORMAL))
        buf += self._get_footer_str()

        invoker.emit_to(buf)
Ejemplo n.º 2
0
    def func(self, invoker, parsed_cmd):
        bridge = invoker.location
        ship = bridge.get_ship_obj()
        solar_system = ship.get_solar_system_obj()

        is_landed = ship.is_ship_landed()
        ship_status = 'Landed' if is_landed else 'In flight'
        ship_location = solar_system.get_appearance_name(invoker)
        ship_id = '[%s]' % ship.id

        max_shield_hp = ship.get_max_shield_hp()
        current_shield_hp = ship.get_current_shield_hp()
        shield_bar, shield_perc, shield_color = progress_bar_str(
            24, max_shield_hp, current_shield_hp)
        max_hull_hp = ship.get_max_hull_hp()
        current_hull_hp = ship.get_current_hull_hp()
        hull_bar, hull_perc, hull_color = progress_bar_str(
            24, max_hull_hp, current_hull_hp)

        buf = self._get_footer_str() + "\n"
        buf += (
            "Ship Name: {ship_name:<22} ID: {ship_id:<7} Ship Type: {ship_type} ({ship_reference})\n"
            "State: {ship_status:<15} Ship Location: {ship_location}\n\n"
            " Shield: {shield_bar} {shield_color}{shield_perc}%{escape_color}"
            "   Hull: {hull_bar} {hull_color}{hull_perc}%{escape_color}"
        ).format(ship_name=ship.display_name,
                 ship_id=ship_id,
                 ship_type=ship.ship_type_name,
                 ship_reference=ship.ship_reference,
                 ship_status=ship_status,
                 ship_location=ship_location,
                 shield_bar=shield_bar,
                 shield_color=shield_color,
                 shield_perc=shield_perc,
                 hull_bar=hull_bar,
                 hull_perc=hull_perc,
                 hull_color=hull_color,
                 escape_color=ANSI_NORMAL)
        buf += self._get_footer_str(pad_char='-')
        buf += '\n Reactor Utilization: {power_util} of {max_power} units'.format(
            power_util=ship.get_total_power_unit_usage(),
            max_power=ship.get_max_power_units())
        buf += ('\n Shields: {shield_units:<3} Engines: {engine_units:<3} '
                'Weapons: {weapon_units:<3} Drones: {drone_units:<3} '
                'Specials: {special_units:<3}'.format(
                    shield_units=ship.get_shield_power_unit_usage(),
                    engine_units=ship.get_engine_power_unit_usage(),
                    weapon_units=ship.get_weapon_power_unit_usage(),
                    drone_units=ship.get_drone_power_unit_usage(),
                    special_units=ship.get_specials_power_unit_usage()))
        buf += self._get_footer_str()
        buf += '\n----- Weapon ----------- [##] Power --- Status ||--- Ammo Type ---- Rounds'
        buf += '\n {weapon_name:<23} [{weapon_num:>2}] 1 unit    {cycle_state:<6}'.format(
            weapon_num=1, weapon_name='Small Ion Cannon', cycle_state='Ready')
        buf += self._get_footer_str(pad_char='-')

        invoker.emit_to(buf)
Ejemplo n.º 3
0
    def func(self, invoker, parsed_cmd):
        bridge = invoker.location
        ship = bridge.get_ship_obj()
        solar_system = ship.get_solar_system_obj()

        if ship.is_ship_landed():
            raise CommandError("What contacts? You aren't in space.")

        buf = self._get_header_str("Contacts near %s" %
                                   ship.location.get_appearance_name(invoker))
        for contact in ship.get_visible_contacts():
            shield_bar, shield_perc, shield_color = progress_bar_str(
                12, contact.get_max_shield_hp(),
                contact.get_current_shield_hp())
            hull_bar, hull_perc, hull_color = progress_bar_str(
                12, contact.get_max_hull_hp(), contact.get_current_hull_hp())
            standing_val = contact.check_ship_standing(ship)
            standing_str, standing_color = get_standing_value_cosmetics(
                standing_val)
            status_flags = self._get_short_status_flags(contact)

            buf += (
                "\n {standing_color}{id:>5}]{ship_class_code:<1}  {ship_reference:<10} "
                "{display_name:<20} S:{shield_bar} H:{hull_bar}  "
                "S:{status_flags}{escape_color}".format(
                    standing_color=standing_color,
                    id=contact.id,
                    ship_class_code=contact.ship_class_code,
                    ship_reference=contact.ship_reference,
                    display_name=contact.display_name,
                    shield_bar=shield_bar,
                    hull_bar=hull_bar,
                    status_flags=status_flags,
                    escape_color=ANSI_NORMAL))
        buf += self._get_footer_str()

        invoker.emit_to(buf)
Ejemplo n.º 4
0
    def func(self, invoker, parsed_cmd):
        bridge = invoker.location
        ship = bridge.get_ship_obj()
        solar_system = ship.get_solar_system_obj()

        is_landed = ship.is_ship_landed()
        ship_status = 'Landed' if is_landed else 'In flight'
        ship_location = solar_system.get_appearance_name(invoker)
        ship_id = '[%s]' % ship.id

        max_shield_hp = ship.get_max_shield_hp()
        current_shield_hp = ship.get_current_shield_hp()
        shield_bar, shield_perc, shield_color = progress_bar_str(
            24, max_shield_hp, current_shield_hp)
        max_hull_hp = ship.get_max_hull_hp()
        current_hull_hp = ship.get_current_hull_hp()
        hull_bar, hull_perc, hull_color = progress_bar_str(
            24, max_hull_hp, current_hull_hp)

        buf = self._get_footer_str() + "\n"
        buf += (
            "Ship Name: {ship_name:<22} ID: {ship_id:<7} Ship Type: {ship_type} ({ship_reference})\n"
            "State: {ship_status:<15} Ship Location: {ship_location}\n\n"
            " Shield: {shield_bar} {shield_color}{shield_perc}%{escape_color}"
            "   Hull: {hull_bar} {hull_color}{hull_perc}%{escape_color}"
        ).format(
            ship_name=ship.display_name,
            ship_id=ship_id,
            ship_type=ship.ship_type_name,
            ship_reference=ship.ship_reference,
            ship_status=ship_status,
            ship_location=ship_location,
            shield_bar=shield_bar,
            shield_color=shield_color,
            shield_perc=shield_perc,
            hull_bar=hull_bar,
            hull_perc=hull_perc,
            hull_color=hull_color,
            escape_color=ANSI_NORMAL)
        buf += self._get_footer_str(pad_char='-')
        buf += '\n Reactor Utilization: {power_util} of {max_power} units'.format(
            power_util=ship.get_total_power_unit_usage(),
            max_power=ship.get_max_power_units())
        buf += (
            '\n Shields: {shield_units:<3} Engines: {engine_units:<3} '
            'Weapons: {weapon_units:<3} Drones: {drone_units:<3} '
            'Specials: {special_units:<3}'.format(
            shield_units=ship.get_shield_power_unit_usage(),
            engine_units=ship.get_engine_power_unit_usage(),
            weapon_units=ship.get_weapon_power_unit_usage(),
            drone_units=ship.get_drone_power_unit_usage(),
            special_units=ship.get_specials_power_unit_usage()))
        buf += self._get_footer_str()
        buf += '\n----- Weapon ----------- [##] Power --- Status ||--- Ammo Type ---- Rounds'
        buf += '\n {weapon_name:<23} [{weapon_num:>2}] 1 unit    {cycle_state:<6}'.format(
            weapon_num=1,
            weapon_name='Small Ion Cannon',
            cycle_state='Ready')
        buf += self._get_footer_str(pad_char='-')

        invoker.emit_to(buf)