Beispiel #1
0
 def func(self):
     """returns the list of online characters"""
     count_accounts = (SESSIONS.account_count())
     self.caller.msg("[%s] Through the fog you see:" % self.key)
     session_list = SESSIONS.get_sessions()
     table = evtable.EvTable(border='none')
     table.add_row('Character', 'On for', 'Idle',  'Location')
     for session in session_list:
         if not session.logged_in:
             continue
         delta_cmd = time.time() - session.cmd_last_visible
         delta_conn = time.time() - session.conn_time
         puppet = session.get_puppet()
         location = puppet.location.key if puppet and puppet.location else 'Nothingness'
         table.add_row(puppet.key if puppet else 'None', utils.time_format(delta_conn, 0),
                       utils.time_format(delta_cmd, 1), location)
     table.reformat_column(0, width=25, align='l')
     table.reformat_column(1, width=12, align='l')
     table.reformat_column(2, width=7, align='l')
     table.reformat_column(3, width=25, align='l')
     is_one = count_accounts == 1
     string = '%s' % 'A' if is_one else str(count_accounts)
     string += ' single ' if is_one else ' unique '
     plural = ' is' if is_one else 's are'
     string += 'account%s logged in.' % plural
     self.caller.msg(table)
     self.caller.msg(string)
Beispiel #2
0
 def func(self):
     self.caller.msg(
         "## BEGIN INFO 1.1\nName: %s\nUptime: %s\nConnected: %d\nVersion: Evennia %s\n## END INFO"
         % (settings.SERVERNAME,
            datetime.datetime.fromtimestamp(
                gametime.SERVER_START_TIME).ctime(),
            SESSIONS.account_count(), utils.get_evennia_version()))
Beispiel #3
0
 def func(self):
     """returns the list of online characters"""
     count_accounts = (SESSIONS.account_count())
     self.caller.msg('[%s] Through the fog you see:' % self.key)
     session_list = SESSIONS.get_sessions()
     table = evtable.EvTable(border='none')
     table.add_row('Character', 'On for', 'Idle',  'Location')
     for session in session_list:
         puppet = session.get_puppet()
         if not session.logged_in or not puppet:
             continue
         delta_cmd = time.time() - session.cmd_last_visible
         delta_conn = time.time() - session.conn_time
         location = puppet.location.key if puppet and puppet.location else 'Nothingness'
         table.add_row(puppet.key if puppet else 'None', utils.time_format(delta_conn, 0),
                       utils.time_format(delta_cmd, 1), location)
     table.reformat_column(0, width=25, align='l')
     table.reformat_column(1, width=12, align='l')
     table.reformat_column(2, width=7, align='l')
     table.reformat_column(3, width=25, align='l')
     is_one = count_accounts == 1
     string = '%s' % 'A' if is_one else str(count_accounts)
     string += ' single ' if is_one else ' unique '
     plural = ' is' if is_one else 's are'
     string += 'account%s logged in.' % plural
     self.caller.msg(table)
     self.caller.msg(string)
Beispiel #4
0
 def test_info_command(self):
     expected = "## BEGIN INFO 1.1\nName: %s\nUptime: %s\nConnected: %d\nVersion: Evennia %s\n## END INFO" % (
         settings.SERVERNAME,
         datetime.datetime.fromtimestamp(
             gametime.SERVER_START_TIME).ctime(), SESSIONS.account_count(),
         utils.get_evennia_version())
     self.call(unloggedin.CmdUnconnectedInfo(), "", expected)
Beispiel #5
0
 def test_info_command(self):
     # instead of using SERVER_START_TIME (0), we use 86400 because Windows won't let us use anything lower
     gametime.SERVER_START_TIME = 86400
     expected = "## BEGIN INFO 1.1\nName: %s\nUptime: %s\nConnected: %d\nVersion: Evennia %s\n## END INFO" % (
                     settings.SERVERNAME,
                     datetime.datetime.fromtimestamp(gametime.SERVER_START_TIME).ctime(),
                     SESSIONS.account_count(), utils.get_evennia_version())
     self.call(unloggedin.CmdUnconnectedInfo(), "", expected)
     del gametime.SERVER_START_TIME
Beispiel #6
0
    def func(self):
        """
        Get all connected accounts by polling session.
        """

        account = self.account
        session_list = SESSIONS.get_sessions()

        session_list = sorted(session_list, key=lambda o: o.account.key)

        if self.cmdstring == "doing":
            show_session_data = False
        else:
            show_session_data = account.check_permstring(
                "Developer") or account.check_permstring("Admins")

        naccounts = SESSIONS.account_count()
        if show_session_data:
            # privileged info
            table = self.styled_table("|wAccount Name", "|wOn for", "|wIdle",
                                      "|wPuppeting", "|wRoom", "|wCmds",
                                      "|wProtocol", "|wHost")
            for session in session_list:
                if not session.logged_in:
                    continue
                delta_cmd = time.time() - session.cmd_last_visible
                delta_conn = time.time() - session.conn_time
                account = session.get_account()
                puppet = session.get_puppet()
                location = puppet.location.key if puppet and puppet.location else "None"
                table.add_row(
                    utils.crop(account.get_display_name(account), width=25),
                    utils.time_format(delta_conn, 0),
                    utils.time_format(delta_cmd, 1),
                    utils.crop(
                        puppet.get_display_name(account) if puppet else "None",
                        width=25), utils.crop(location, width=25),
                    session.cmd_total, session.protocol_key,
                    isinstance(session.address, tuple) and session.address[0]
                    or session.address)
        else:
            # unprivileged
            table = self.styled_table("|wAccount name", "|wOn for", "|wIdle")
            for session in session_list:
                if not session.logged_in:
                    continue
                delta_cmd = time.time() - session.cmd_last_visible
                delta_conn = time.time() - session.conn_time
                account = session.get_account()
                table.add_row(
                    utils.crop(account.get_display_name(account), width=25),
                    utils.time_format(delta_conn, 0),
                    utils.time_format(delta_cmd, 1))
        is_one = naccounts == 1
        self.msg(
            "|wAccounts:|n\n%s\n%s unique account%s logged in." %
            (table, "One" if is_one else naccounts, "" if is_one else "s"))
Beispiel #7
0
    def func(self):
        """
        Get all connected accounts by polling session.
        """

        account = self.account
        session_list = SESSIONS.get_sessions()

        session_list = sorted(session_list, key=lambda o: o.account.key)

        if self.cmdstring == "doing":
            show_session_data = False
        else:
            show_session_data = account.check_permstring("Developer") or account.check_permstring("Admins")

        naccounts = (SESSIONS.account_count())
        if show_session_data:
            # privileged info
            table = evtable.EvTable("|wAccount Name",
                                    "|wOn for",
                                    "|wIdle",
                                    "|wPuppeting",
                                    "|wRoom",
                                    "|wCmds",
                                    "|wProtocol",
                                    "|wHost")
            for session in session_list:
                if not session.logged_in:
                    continue
                delta_cmd = time.time() - session.cmd_last_visible
                delta_conn = time.time() - session.conn_time
                account = session.get_account()
                puppet = session.get_puppet()
                location = puppet.location.key if puppet and puppet.location else "None"
                table.add_row(utils.crop(account.name, width=25),
                              utils.time_format(delta_conn, 0),
                              utils.time_format(delta_cmd, 1),
                              utils.crop(puppet.key if puppet else "None", width=25),
                              utils.crop(location, width=25),
                              session.cmd_total,
                              session.protocol_key,
                              isinstance(session.address, tuple) and session.address[0] or session.address)
        else:
            # unprivileged
            table = evtable.EvTable("|wAccount name", "|wOn for", "|wIdle")
            for session in session_list:
                if not session.logged_in:
                    continue
                delta_cmd = time.time() - session.cmd_last_visible
                delta_conn = time.time() - session.conn_time
                account = session.get_account()
                table.add_row(utils.crop(account.key, width=25),
                              utils.time_format(delta_conn, 0),
                              utils.time_format(delta_cmd, 1))
        is_one = naccounts == 1
        self.msg("|wAccounts:|n\n%s\n%s unique account%s logged in."
                 % (table, "One" if is_one else naccounts, "" if is_one else "s"))
Beispiel #8
0
    def func(self):
        session_list = SESSIONS.get_sessions()

        table = evtable.EvTable(" |w|uName:|n",
                                "|w|uIdle:|n",
                                "|w|uConn:|n",
                                "|w|uClearance:|n",
                                table=None,
                                border=None,
                                width=78)

        for session in session_list:
            player = session.get_account()
            idle = time.time() - session.cmd_last_visible
            conn = time.time() - session.conn_time
            clearance = session.get_puppet().db.clearance
            flag = None
            if player.locks.check_lockstring(player, "dummy:perm(Admin)"):
                flag = "|y!|n"
            elif player.locks.check_lockstring(player, "dummy:perm(Builder)"):
                flag = "|g&|n"
            elif player.locks.check_lockstring(player, "dummy:perm(Helper)"):
                flag = "|r$|n"
            else:
                flag = " "
            table.add_row(
                flag + utils.crop(player.name), utils.time_format(idle, 0),
                utils.time_format(conn, 0),
                "|{}{}|n".format(clearance_color(CLEARANCE.get(clearance)),
                                 CLEARANCE.get(clearance)))

        table.reformat_column(0, width=24)
        table.reformat_column(1, width=12)
        table.reformat_column(2, width=12)
        table.reformat_column(3, width=30)

        self.caller.msg("|w_|n" * 78)
        title = ansi.ANSIString("|[002|w|u{}|n".format(settings.SERVERNAME))
        self.caller.msg(title.center(78, '^').replace('^', "|[002|w_|n"))

        self.caller.msg(table)
        self.caller.msg("|w_|n" * 78)
        self.caller.msg("Total Connected: %s" % SESSIONS.account_count())
        whotable = evtable.EvTable("", "", "", header=False, border=None)
        whotable.reformat_column(0, width=26)
        whotable.reformat_column(1, width=26)
        whotable.reformat_column(2, width=26)
        whotable.add_row("|y!|n - Administrators", "|g&|n - Storytellers",
                         "|r$|n - Player Helpers")
        self.caller.msg(whotable)
        self.caller.msg("|w_|n" * 78 + "\n")
Beispiel #9
0
    def _form_and_send_request(self):
        """
        Build the request to send to the index.

        """
        agent = Agent(reactor, pool=self._conn_pool)
        headers = {
            b'User-Agent': [b'Evennia Game Index Client'],
            b'Content-Type': [b'application/x-www-form-urlencoded'],
        }
        egi_config = settings.GAME_INDEX_LISTING
        # We are using `or` statements below with dict.get() to avoid sending
        # stringified 'None' values to the server.
        try:
            values = {
                # Game listing stuff
                'game_name': egi_config.get('game_name', settings.SERVERNAME),
                'game_status': egi_config['game_status'],
                'game_website': egi_config.get('game_website', ''),
                'short_description': egi_config['short_description'],
                'long_description': egi_config.get('long_description', ''),
                'listing_contact': egi_config['listing_contact'],

                # How to play
                'telnet_hostname': egi_config.get('telnet_hostname', ''),
                'telnet_port': egi_config.get('telnet_port', ''),
                'web_client_url': egi_config.get('web_client_url', ''),

                # Game stats
                'connected_account_count': SESSIONS.account_count(),
                'total_account_count': AccountDB.objects.num_total_accounts() or 0,

                # System info
                'evennia_version': get_evennia_version(),
                'python_version': platform.python_version(),
                'django_version': django.get_version(),
                'server_platform': platform.platform(),
            }
        except KeyError as err:
            raise KeyError(f"Error loading GAME_INDEX_LISTING: {err}")

        data = urllib.parse.urlencode(values)

        d = agent.request(
            b'POST', bytes(self.report_url, 'utf-8'),
            headers=Headers(headers),
            bodyProducer=StringProducer(data))

        d.addCallback(self.handle_egd_response)
        return d
Beispiel #10
0
    def _form_and_send_request(self):
        """
        Build the request to send to the index.

        """
        agent = Agent(reactor, pool=self._conn_pool)
        headers = {
            b"User-Agent": [b"Evennia Game Index Client"],
            b"Content-Type": [b"application/x-www-form-urlencoded"],
        }
        egi_config = settings.GAME_INDEX_LISTING
        # We are using `or` statements below with dict.get() to avoid sending
        # stringified 'None' values to the server.
        try:
            values = {
                # Game listing stuff
                "game_name": egi_config.get("game_name", settings.SERVERNAME),
                "game_status": egi_config["game_status"],
                "game_website": egi_config.get("game_website", ""),
                "short_description": egi_config["short_description"],
                "long_description": egi_config.get("long_description", ""),
                "listing_contact": egi_config["listing_contact"],
                # How to play
                "telnet_hostname": egi_config.get("telnet_hostname", ""),
                "telnet_port": egi_config.get("telnet_port", ""),
                "web_client_url": egi_config.get("web_client_url", ""),
                # Game stats
                "connected_account_count": SESSIONS.account_count(),
                "total_account_count": AccountDB.objects.num_total_accounts()
                or 0,
                # System info
                "evennia_version": get_evennia_version(),
                "python_version": platform.python_version(),
                "django_version": django.get_version(),
                "server_platform": platform.platform(),
            }
        except KeyError as err:
            raise KeyError(f"Error loading GAME_INDEX_LISTING: {err}")

        data = urllib.parse.urlencode(values)

        d = agent.request(
            b"POST",
            bytes(self.report_url, "utf-8"),
            headers=Headers(headers),
            bodyProducer=StringProducer(data),
        )

        d.addCallback(self.handle_egd_response)
        return d
Beispiel #11
0
    def _form_and_send_request(self):
        agent = Agent(reactor, pool=self._conn_pool)
        headers = {
            'User-Agent': ['Evennia Game Index Client'],
            'Content-Type': ['application/x-www-form-urlencoded'],
        }
        egi_config = self._get_config_dict()
        # We are using `or` statements below with dict.get() to avoid sending
        # stringified 'None' values to the server.
        values = {
            # Game listing stuff
            'game_name': settings.SERVERNAME,
            'game_status': egi_config['game_status'],
            'game_website': egi_config.get('game_website') or '',
            'short_description': egi_config['short_description'],
            'long_description': egi_config.get('long_description') or '',
            'listing_contact': egi_config['listing_contact'],

            # How to play
            'telnet_hostname': egi_config.get('telnet_hostname') or '',
            'telnet_port': egi_config.get('telnet_port') or '',
            'web_client_url': egi_config.get('web_client_url') or '',

            # Game stats
            'connected_account_count': SESSIONS.account_count(),
            'total_account_count': AccountDB.objects.num_total_accounts() or 0,

            # System info
            'evennia_version': get_evennia_version(),
            'python_version': platform.python_version(),
            'django_version': django.get_version(),
            'server_platform': platform.platform(),
        }
        data = urllib.urlencode(values)

        d = agent.request('POST',
                          self.report_url,
                          headers=Headers(headers),
                          bodyProducer=StringProducer(data))

        d.addCallback(self.handle_egd_response)
        return d
Beispiel #12
0
    def _form_and_send_request(self):
        agent = Agent(reactor, pool=self._conn_pool)
        headers = {
            'User-Agent': ['Evennia Game Index Client'],
            'Content-Type': ['application/x-www-form-urlencoded'],
        }
        egi_config = self._get_config_dict()
        # We are using `or` statements below with dict.get() to avoid sending
        # stringified 'None' values to the server.
        values = {
            # Game listing stuff
            'game_name': settings.SERVERNAME,
            'game_status': egi_config['game_status'],
            'game_website': egi_config.get('game_website') or '',
            'short_description': egi_config['short_description'],
            'long_description': egi_config.get('long_description') or '',
            'listing_contact': egi_config['listing_contact'],

            # How to play
            'telnet_hostname': egi_config.get('telnet_hostname') or '',
            'telnet_port': egi_config.get('telnet_port') or '',
            'web_client_url': egi_config.get('web_client_url') or '',

            # Game stats
            'connected_account_count': SESSIONS.account_count(),
            'total_account_count': AccountDB.objects.num_total_accounts() or 0,

            # System info
            'evennia_version': get_evennia_version(),
            'python_version': platform.python_version(),
            'django_version': django.get_version(),
            'server_platform': platform.platform(),
        }
        data = urllib.urlencode(values)

        d = agent.request(
            'POST', self.report_url,
            headers=Headers(headers),
            bodyProducer=StringProducer(data))

        d.addCallback(self.handle_egd_response)
        return d
Beispiel #13
0
 def func(self):
     self.caller.msg("## BEGIN INFO 1.1\nName: %s\nUptime: %s\nConnected: %d\nVersion: Evennia %s\n## END INFO" % (
                     settings.SERVERNAME,
                     datetime.datetime.fromtimestamp(gametime.SERVER_START_TIME).ctime(),
                     SESSIONS.account_count(), utils.get_evennia_version()))
Beispiel #14
0
 def func(self):
     """Get all connected accounts by polling session."""
     you = self.account
     session_list = SESSIONS.get_sessions()
     cmd = self.cmdstring
     show_session_data = you.check_permstring('Immortals') and not you.attributes.has('_quell')
     account_count = (SESSIONS.account_count())
     table = evtable.EvTable(border='none', pad_width=0, border_width=0, maxwidth=79)
     if cmd == 'wa' or cmd == 'where':
         # Example output expected:
         # Occ, Location,  Avg Time, Top 3 Active, Directions
         # #3 	Park 		5m 		Rulan, Amber, Tria		Taxi, Park
         # Other possible sort methods: Alphabetical by name, by occupant count, by activity, by distance
         # Nick = Global Nick (no greater than five A/N or randomly created if not a Global Nick
         #
         # WA with name parameters to pull up more extensive information about the direction
         # Highest Occupants (since last reboot), Last Visited, Last Busy (3+) etc. (more ideas here)
         table.add_header('|wOcc', '|wLocation', '|wAvg Time', '|cTop 3 Active', '|gDirections')
         table.reformat_column(0, width=4, align='l')
         table.reformat_column(1, width=25, align='l')
         table.reformat_column(2, width=6, align='l')
         table.reformat_column(3, width=16, pad_right=1, align='l')
         table.reformat_column(4, width=20, align='l')
         locations = {}  # Create an empty dictionary to gather locations information.
         for session in session_list:  # Go through connected list and see who's where.
             if not session.logged_in:
                 continue
             character = session.get_puppet()
             if not character:
                 continue
             if character.location not in locations:
                 locations[character.location] = []
             locations[character.location].append(character)  # Build the list of who's in a location
         for place in locations:
             location = place.get_display_name(you) if place else '|222Nothingness|n'
             table.add_row(len(locations[place]), location, '?',
                           ', '.join(each.get_display_name(you) for each in locations[place]),
                           'Summon or walk')
     elif cmd == 'ws':
         my_character = self.caller.get_puppet(self.session)
         if not (my_character and my_character.location):
             self.msg("You can't see anyone here.")
             return
         table.add_header('|wCharacter', '|wOn for', '|wIdle')
         table.reformat_column(0, width=45, align='l')
         table.reformat_column(1, width=8, align='l')
         table.reformat_column(2, width=7, pad_right=1, align='r')
         for element in my_character.location.contents:
             if not element.has_account:
                 continue
             delta_cmd = time.time() - max([each.cmd_last_visible for each in element.sessions.all()])
             delta_con = time.time() - min([each.conn_time for each in element.sessions.all()])
             name = element.get_display_name(you)
             type = element.attributes.get('species', default='')
             table.add_row(name + ', ' + type if type else name,
                           utils.time_format(delta_con, 0), utils.time_format(delta_cmd, 1))
     elif cmd == 'what' or cmd == 'wot':
         table.add_header('|wCharacter  - Doing', '|wIdle')
         table.reformat_column(0, width=72, align='l')
         table.reformat_column(1, width=7, align='r')
         for session in session_list:
             if not session.logged_in or not session.get_puppet():
                 continue
             delta_cmd = time.time() - session.cmd_last_visible
             character = session.get_puppet()
             doing = character.get_display_name(you, pose=True)
             table.add_row(doing, utils.time_format(delta_cmd, 1))
     else:  # Default to displaying who
         if show_session_data:  # privileged info shown to Immortals and higher only when not quelled
             table.add_header('|wCharacter', '|wAccount', '|wQuell', '|wCmds', '|wProtocol', '|wAddress')
             table.reformat_column(0, align='l')
             table.reformat_column(1, align='r')
             table.reformat_column(2, width=7, align='r')
             table.reformat_column(3, width=6, pad_right=1, align='r')
             table.reformat_column(4, width=11, align='l')
             table.reformat_column(5, width=16, align='r')
             session_list = sorted(session_list, key=lambda o: o.account.key)
             for session in session_list:
                 if not session.logged_in:
                     continue
                 account = session.get_account()
                 puppet = session.get_puppet()
                 table.add_row(puppet.get_display_name(you) if puppet else 'None',
                               account.get_display_name(you),
                               '|gYes|n' if account.attributes.get('_quell') else '|rNo|n',
                               session.cmd_total, session.protocol_key,
                               isinstance(session.address, tuple) and session.address[0] or session.address)
         else:  # unprivileged info shown to everyone, including Immortals and higher when quelled
             table.add_header('|wCharacter', '|wOn for', '|wIdle')
             table.reformat_column(0, width=40, align='l')
             table.reformat_column(1, width=8, align='l')
             table.reformat_column(2, width=7, align='r')
             for session in session_list:
                 if not session.logged_in:
                     continue
                 delta_cmd = time.time() - session.cmd_last_visible
                 delta_conn = time.time() - session.conn_time
                 character = session.get_puppet()
                 if not character:
                     continue
                 table.add_row(character.get_display_name(you), utils.time_format(delta_conn, 0),
                               utils.time_format(delta_cmd, 1))
     is_one = account_count == 1
     string = '%s' % 'A' if is_one else str(account_count)
     string += ' single ' if is_one else ' unique '
     plural = ' is' if is_one else 's are'
     string += 'account%s logged in.' % plural
     self.msg(table)
     self.msg(string)
Beispiel #15
0
    def func(self):
        session_list = SESSIONS.get_sessions()
        session_list = sorted(session_list,
                              key=lambda ses: ses.get_puppet().name)

        titles1 = ('Artisan GM', 'Assassin GM', 'Druid GM', 'Fighter GM',
                   'Harbinger GM', 'Helotyr GM', 'Mage GM', 'Merchant GM',
                   'Monk GM', 'Ranger GM', 'Samurai GM', 'Sarthoar GM',
                   'Shaman GM', 'Sorcerer GM', 'Templar GM', 'Thief GM',
                   'Trader GM', 'Warrior GM', 'Chief', 'Sherrif',
                   'Gumi Commander', 'Editor in Chief', 'Chief Justice',
                   'Tribune Prime', 'Head Magistrate')
        titles2 = ('Artisan AGM', 'Assassin AGM', 'Druid AGM', 'Fighter AGM',
                   'Harbinger AGM', 'Helotyr AGM', 'Mage AGM', 'Merchant AGM',
                   'Monk AGM', 'Ranger AGM', 'Samurai AGM', 'Sarthoar AGM',
                   'Shaman AGM', 'Sorcerer AGM', 'Templar AGM', 'Thief AGM',
                   'Trader AGM', 'Warrior AGM', 'Vice Chief', 'Under-Sheriff',
                   'Gumi Captain', 'Editor', 'Justice', 'Tribune',
                   'Magistrate')
        titles3 = ('Medjai', 'Gumi', 'Deputy', 'Reporter', 'Kingdom Attorney',
                   'Aedile', 'Champion')
        titles4 = ('Barrister', 'Advocari', 'Counseler')
        titles5 = ('Field Marshal', 'Legate', 'Gensui')
        titles6 = ('General', 'Prefect', 'Taisho')
        titles7 = ('Colonel', 'Captain', 'Lieutenant', 'First Sergeant',
                   'Sergent', 'Corporal', 'Private', 'Recruit',
                   'First Centurion', 'Centurion', 'Decurion', 'Optio',
                   'Tressario', 'Decanus', 'Legionaire', 'Discens', 'Taisa',
                   'Tai', 'Chui', 'Socho', 'Gunso', 'Heicho', 'Ittohei',
                   'Nitohei')

        self.caller.msg(
            "----------------------======]    |CMercadia|n   [======----------------------"
        )
        self.caller.msg(datetime.datetime.now().strftime(
            "            %a %b %d %H:%M:%S %Y Mercadian Time"))
        self.caller.msg("     Mercadia uptime: %s. " %
                        utils.time_format(gametime.uptime(), 3))
        self.caller.msg(
            "----------------------======]     |315Admin|n     [======----------------------"
        )
        self.caller.msg("    Revrwn, |305Administrator|n ")
        self.caller.msg(
            "----------------------======]     |115Staff|n     [======----------------------"
        )
        self.caller.msg("    Jennifer, |405Chief of Staff ")
        self.caller.msg("    Dominic, |045Administrative Staff ")
        self.caller.msg("    Tiffany, |045Administrative Staff ")
        self.caller.msg("    Corry, |045Administrative Staff   ")
        self.caller.msg(
            "----------------------======]   |550Characters|n  [======----------------------"
        )

        for session in session_list:
            puppet = session.get_puppet()
            name = puppet.name
            gender = puppet.db.gender
            race = puppet.db.race
            guild = puppet.db.guild
            owner = puppet.db.owner
            title = puppet.db.title

            slaveentry = ", %s of %s" % (guild, owner)
            guildentry = ", %s" % guild

            if title in titles1:
                title = ", |300%s|n" % title
            elif title in titles2:
                title = ", |500%s|n" % title
            elif title in titles3:
                title = ", |510%s|n" % title
            elif title in titles4:
                title = ", |152%s|n" % title
            elif title in titles5:
                title = ", |203%s|n" % title
            elif title in titles6:
                title = ", |213%s|n" % title
            elif title in titles7:
                title = ", |223%s|n" % title
            else:
                title = " "

            if guild:
                guild = guildentry
            else:
                guild = guild
            if owner:
                guild = slaveentry
            if name in ('Roy', 'Jennifer', 'Dominic', 'Tiffany', 'Corry'):
                continue
            else:
                self.caller.msg(
                    "    %s %s %s%s %s" %
                    (name.capitalize(), gender, race, guild, title))
        self.caller.msg(
            "----------------------======]    |555Online|n     [======----------------------"
        )
        self.caller.msg("           There are currently %s Players Online" %
                        (SESSIONS.account_count()))
        self.caller.msg(
            "----------------------======]|C***************|n[======----------------------"
        )

        if self.args in ("kingdom", 'caliphate', 'empire'):
            self.caller.msg(
                "----------------------======]    |CMercadia|n   [======----------------------"
            )
            self.caller.msg(datetime.datetime.now().strftime(
                "            %a %b %d %H:%M:%S %Y Mercadian Time"))
            self.caller.msg("     Mercadia uptime: %s. " %
                            utils.time_format(gametime.uptime(), 3))
            self.caller.msg(
                "----------------------======]     |315Admin|n     [======----------------------"
            )
            self.caller.msg("    Revrwn, |305Administrator|n ")
            self.caller.msg(
                "----------------------======]     |115Staff|n     [======----------------------"
            )
            self.caller.msg("    Jennifer, |405Chief of Staff ")
            self.caller.msg("    Dominic, |045Administrative Staff ")
            self.caller.msg("    Tiffany, |045Administrative Staff ")
            self.caller.msg("    Corry, |045Administrative Staff   ")
            self.caller.msg(
                "----------------------======]   |550Characters|n  [======----------------------"
            )

            for session in session_list:
                puppet = session.get_puppet()
                name = puppet.name
                gender = puppet.db.gender
                race = puppet.db.race
                guild = puppet.db.guild
                owner = puppet.db.owner
                title = puppet.db.title
                nation = puppet.db.nation

                slaveentry = ", %s of %s" % (guild, owner)
                guildentry = ", %s" % guild

                if title in titles1:
                    title = ", |300%s|n" % title
                elif title in titles2:
                    title = ", |500%s|n" % title
                elif title in titles3:
                    title = ", |510%s|n" % title
                elif title in titles4:
                    title = ", |152%s|n" % title
                elif title in titles5:
                    title = ", |203%s|n" % title
                elif title in titles6:
                    title = ", |213%s|n" % title
                elif title in titles7:
                    title = ", |223%s|n" % title
                else:
                    title = " "

                if guild:
                    guild = guildentry
                else:
                    guild = guild
                if owner:
                    guild = slaveentry
                if name in ('Roy', 'Jennifer', 'Dominic', 'Tiffany', 'Corry'):
                    continue
                elif self.args.capitalize() not in nation:
                    continue
                else:
                    self.caller.msg(
                        "    %s %s %s%s %s" %
                        (name.capitalize(), gender, race, guild, title))
            self.caller.msg(
                "----------------------======]    |555Online|n     [======----------------------"
            )
            self.caller.msg(
                "           There are currently %s Players Online" %
                (SESSIONS.account_count()))
            self.caller.msg(
                "----------------------======]|C***************|n[======----------------------"
            )

        if self.args in ('human', 'elf', 'dwarf', 'gnome', 'centaur', 'ogryn',
                         'drow', 'duergar', 'svirfneblin', 'wemic', 'drakkar',
                         'ursine', 'feline', 'lupine', 'vulpine', 'naga',
                         'wisp'):
            self.caller.msg(
                "----------------------======]    |CMercadia|n   [======----------------------"
            )
            self.caller.msg(datetime.datetime.now().strftime(
                "            %a %b %d %H:%M:%S %Y Mercadian Time"))
            self.caller.msg("     Mercadia uptime: %s. " %
                            utils.time_format(gametime.uptime(), 3))
            self.caller.msg(
                "----------------------======]     |315Admin|n     [======----------------------"
            )
            self.caller.msg("    Revrwn, |305Administrator|n ")
            self.caller.msg(
                "----------------------======]     |115Staff|n     [======----------------------"
            )
            self.caller.msg("    Jennifer, |405Chief of Staff ")
            self.caller.msg("    Dominic, |045Administrative Staff ")
            self.caller.msg("    Tiffany, |045Administrative Staff ")
            self.caller.msg("    Corry, |045Administrative Staff   ")
            self.caller.msg(
                "----------------------======]   |550Characters|n  [======----------------------"
            )

            for session in session_list:
                puppet = session.get_puppet()
                name = puppet.name
                gender = puppet.db.gender
                race = puppet.db.race
                guild = puppet.db.guild
                owner = puppet.db.owner
                title = puppet.db.title
                nation = puppet.db.nation

                slaveentry = ", %s of %s" % (guild, owner)
                guildentry = ", %s" % guild

                if title in titles1:
                    title = ", |300%s|n" % title
                elif title in titles2:
                    title = ", |500%s|n" % title
                elif title in titles3:
                    title = ", |510%s|n" % title
                elif title in titles4:
                    title = ", |152%s|n" % title
                elif title in titles5:
                    title = ", |203%s|n" % title
                elif title in titles6:
                    title = ", |213%s|n" % title
                elif title in titles7:
                    title = ", |223%s|n" % title
                else:
                    title = " "

                if guild:
                    guild = guildentry
                else:
                    guild = guild
                if owner:
                    guild = slaveentry
                if name in ('Roy', 'Jennifer', 'Dominic', 'Tiffany', 'Corry'):
                    continue
                elif self.args.capitalize() not in race:
                    continue
                else:
                    self.caller.msg(
                        "    %s %s %s%s %s" %
                        (name.capitalize(), gender, race, guild, title))
            self.caller.msg(
                "----------------------======]    |555Online|n     [======----------------------"
            )
            self.caller.msg(
                "           There are currently %s Players Online" %
                (SESSIONS.account_count()))
            self.caller.msg(
                "----------------------======]|C***************|n[======----------------------"
            )
Beispiel #16
0
 def test_info_command(self):
     expected = "## BEGIN INFO 1.1\nName: %s\nUptime: %s\nConnected: %d\nVersion: Evennia %s\n## END INFO" % (
                     settings.SERVERNAME,
                     datetime.datetime.fromtimestamp(gametime.SERVER_START_TIME).ctime(),
                     SESSIONS.account_count(), utils.get_evennia_version())
     self.call(unloggedin.CmdUnconnectedInfo(), "", expected)
Beispiel #17
0
 def func(self):
     """Get all connected accounts by polling session."""
     you = self.account
     session_list = SESSIONS.get_sessions()
     cmd = self.cmdstring
     show_session_data = you.check_permstring(
         'Immortals') and not you.attributes.has('_quell')
     account_count = (SESSIONS.account_count())
     table = evtable.EvTable(border='none',
                             pad_width=0,
                             border_width=0,
                             maxwidth=79)
     if cmd == 'wa' or cmd == 'where':
         # Example output expected:
         # Occ, Location,  Avg Time, Top 3 Active, Directions
         # #3 	Park 		5m 		Rulan, Amber, Tria		Taxi, Park
         # Other possible sort methods: Alphabetical by name, by occupant count, by activity, by distance
         # Nick = Global Nick (no greater than five A/N or randomly created if not a Global Nick
         #
         # WA with name parameters to pull up more extensive information about the direction
         # Highest Occupants (since last reboot), Last Visited, Last Busy (3+) etc. (more ideas here)
         table.add_header('|wOcc', '|wLocation', '|wAvg Time',
                          '|cTop 3 Active', '|gDirections')
         table.reformat_column(0, width=4, align='l')
         table.reformat_column(1, width=25, align='l')
         table.reformat_column(2, width=6, align='l')
         table.reformat_column(3, width=16, pad_right=1, align='l')
         table.reformat_column(4, width=20, align='l')
         locations = {
         }  # Create an empty dictionary to gather locations information.
         for session in session_list:  # Go through connected list and see who's where.
             if not session.logged_in:
                 continue
             character = session.get_puppet()
             if not character:
                 continue
             if character.location not in locations:
                 locations[character.location] = []
             locations[character.location].append(
                 character)  # Build the list of who's in a location
         for place in locations:
             location = place.get_display_name(
                 you) if place else '|222Nothingness|n'
             table.add_row(
                 len(locations[place]), location, '?', ', '.join(
                     each.get_display_name(you)
                     for each in locations[place]), 'Summon or walk')
     elif cmd == 'ws':
         my_character = self.caller.get_puppet(self.session)
         if not (my_character and my_character.location):
             self.msg("You can't see anyone here.")
             return
         table.add_header('|wCharacter', '|wOn for', '|wIdle')
         table.reformat_column(0, width=45, align='l')
         table.reformat_column(1, width=8, align='l')
         table.reformat_column(2, width=7, pad_right=1, align='r')
         for element in my_character.location.contents:
             if not element.has_account:
                 continue
             delta_cmd = time.time() - max(
                 [each.cmd_last_visible for each in element.sessions.all()])
             delta_con = time.time() - min(
                 [each.conn_time for each in element.sessions.all()])
             name = element.get_display_name(you)
             type = element.attributes.get('species', default='')
             table.add_row(name + ', ' + type if type else name,
                           utils.time_format(delta_con, 0),
                           utils.time_format(delta_cmd, 1))
     elif cmd == 'what' or cmd == 'wot':
         table.add_header('|wCharacter  - Doing', '|wIdle')
         table.reformat_column(0, width=72, align='l')
         table.reformat_column(1, width=7, align='r')
         for session in session_list:
             if not session.logged_in or not session.get_puppet():
                 continue
             delta_cmd = time.time() - session.cmd_last_visible
             character = session.get_puppet()
             doing = character.get_display_name(you, pose=True)
             table.add_row(doing, utils.time_format(delta_cmd, 1))
     else:  # Default to displaying who
         if show_session_data:  # privileged info shown to Immortals and higher only when not quelled
             table.add_header('|wCharacter', '|wAccount', '|wQuell',
                              '|wCmds', '|wProtocol', '|wAddress')
             table.reformat_column(0, align='l')
             table.reformat_column(1, align='r')
             table.reformat_column(2, width=7, align='r')
             table.reformat_column(3, width=6, pad_right=1, align='r')
             table.reformat_column(4, width=11, align='l')
             table.reformat_column(5, width=16, align='r')
             session_list = sorted(session_list,
                                   key=lambda o: o.account.key)
             for session in session_list:
                 if not session.logged_in:
                     continue
                 account = session.get_account()
                 puppet = session.get_puppet()
                 table.add_row(
                     puppet.get_display_name(you) if puppet else 'None',
                     account.get_display_name(you), '|gYes|n'
                     if account.attributes.get('_quell') else '|rNo|n',
                     session.cmd_total, session.protocol_key,
                     isinstance(session.address, tuple)
                     and session.address[0] or session.address)
         else:  # unprivileged info shown to everyone, including Immortals and higher when quelled
             table.add_header('|wCharacter', '|wOn for', '|wIdle')
             table.reformat_column(0, width=40, align='l')
             table.reformat_column(1, width=8, align='l')
             table.reformat_column(2, width=7, align='r')
             for session in session_list:
                 if not session.logged_in:
                     continue
                 delta_cmd = time.time() - session.cmd_last_visible
                 delta_conn = time.time() - session.conn_time
                 character = session.get_puppet()
                 if not character:
                     continue
                 table.add_row(character.get_display_name(you),
                               utils.time_format(delta_conn, 0),
                               utils.time_format(delta_cmd, 1))
     is_one = account_count == 1
     string = '%s' % 'A' if is_one else str(account_count)
     string += ' single ' if is_one else ' unique '
     plural = ' is' if is_one else 's are'
     string += 'account%s logged in.' % plural
     self.msg(table)
     self.msg(string)
Beispiel #18
0
 def inner_func(self):
     """Get all connected accounts by polling session."""
     account = self.account
     session_list = SESSIONS.get_sessions()
     session_list = sorted(session_list, key=lambda o: o.account.key)
     show_session_data = account.check_permstring(
         "Developer") or account.check_permstring("Admins")
     naccounts = SESSIONS.account_count()
     if show_session_data:
         # privileged info
         table = self.styled_table(
             "|wAccount Name",
             "|wOn for",
             "|wIdle",
             "|wPuppeting",
             "|wLevel",
             "|wClass",
             "|wRoom",
             "|wCmds",
             "|wProtocol",
             "|wHost",
         )
         for session in session_list:
             if not session.logged_in:
                 continue
             delta_cmd = time.time() - session.cmd_last_visible
             delta_conn = time.time() - session.conn_time
             account = session.get_account()
             puppet = session.get_puppet()
             location = puppet.location.key if puppet and puppet.location else "None"
             table.add_row(
                 utils.crop(account.get_display_name(account), width=25),
                 utils.time_format(delta_conn, 0),
                 utils.time_format(delta_cmd, 1),
                 utils.crop(
                     puppet.get_display_name(account) if puppet else "None",
                     width=25),
                 puppet.level if hasattr(puppet, "level") else 0,
                 puppet.classname
                 if hasattr(puppet, "classname") else "None",
                 utils.crop(location, width=25),
                 session.cmd_total,
                 session.protocol_key,
                 isinstance(session.address, tuple) and session.address[0]
                 or session.address,
             )
     else:
         # unprivileged
         table = self.styled_table(
             "|wUsername",
             "|wGame Name",
             "|wLevel",
             "|wClass",
             "|wWhere",
         )
         for session in session_list:
             if not session.logged_in:
                 continue
             delta_cmd = time.time() - session.cmd_last_visible
             delta_conn = time.time() - session.conn_time
             account = session.get_account()
             puppet = session.get_puppet()
             location = puppet.location.key if puppet and puppet.location else "None"
             table.add_row(
                 utils.crop(account.get_display_name(account), width=25),
                 utils.crop(
                     puppet.get_display_name(account) if puppet else "None",
                     width=25),
                 puppet.level if hasattr(puppet, "level") else 0,
                 puppet.classname
                 if hasattr(puppet, "classname") else "None",
                 utils.crop(location, width=25),
             )
     self.msg(
         "|w                     Monster Status\n                  26-FEB-1991  8:38pm\n                  * - Monster Operator|n\n%s"
         % table)