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()))
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
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
def func(self): """Show the connect screen.""" connection_screen = """ |b==============================================================|n Welcome to |g{}|n, version {}! If you have an existing account, connect to it by typing: |wconnect <username> <password>|n If you need to create an account, type (without the <>'s): |wcreate <username> <password>|n If you have spaces in your username, enclose it in quotes. Enter |whelp|n for more info. |wlook|n will re-show this screen. |b==============================================================|n""" \ .format(settings.SERVERNAME, utils.get_evennia_version()) self.caller.msg(connection_screen)
def _form_and_send_request(self): agent = Agent(reactor, pool=self._conn_pool) headers = { 'User-Agent': ['Evennia Game Directory Client'], 'Content-Type': ['application/x-www-form-urlencoded'], } gd_config = settings.GAME_DIRECTORY_LISTING # 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': gd_config['game_status'], 'game_website': gd_config.get('game_website') or '', 'short_description': gd_config.get('short_description') or '', 'long_description': gd_config.get('long_description') or '', 'listing_contact': gd_config['listing_contact'], # How to play 'telnet_hostname': gd_config.get('telnet_hostname') or '', 'telnet_port': gd_config.get('telnet_port') or '', 'web_client_url': gd_config.get('web_client_url') or '', # Game stats 'connected_player_count': SESSIONS.player_count(), 'total_player_count': PlayerDB.objects.num_total_players() 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
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_player_count': SESSIONS.player_count(), 'total_player_count': PlayerDB.objects.num_total_players() 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
def func(self): """Show the version""" string = """ |cEvennia|n %s|n MUD/MUX/MU* development system |wLicence|n BSD 3-Clause Licence: https://opensource.org/licenses/BSD-3-Clause |wWeb|n http://www.evennia.com |wIrc|n #evennia on FreeNode |wForum|n http://www.evennia.com/discussions |wMaintainer|n (2010-) Griatch (griatch AT gmail DOT com) |wMaintainer|n (2006-10) Greg Taylor |wOS|n %s |wPython|n %s |wTwisted|n %s |wDjango|n %s """ % (utils.get_evennia_version(), os.name, sys.version.split()[0], twisted.version.short(), django.get_version()) self.caller.msg(string)
def send_authenticate(self, *args, **kwargs): """ Send grapevine authentication. This should be send immediately upon connection. """ data = { "event": "authenticate", "payload": { "client_id": GRAPEVINE_CLIENT_ID, "client_secret": GRAPEVINE_CLIENT_SECRET, "supports": ["channels"], "channels": GRAPEVINE_CHANNELS, "version": "1.0.0", "user_agent": get_evennia_version("pretty"), }, } # override on-the-fly data.update(kwargs) self._send_json(data)
variable is given, Evennia will pick one of them at random. The commands available to the user when the connection screen is shown are defined in evennia.default_cmds.UnloggedinCmdSet. The parsing and display of the screen is done by the unlogged-in "look" command. """ from django.conf import settings from evennia import utils CONNECTION_SCREEN = """|113==============================================================================|n Welcome to |113{}|n! |145{}|n If you have an existing account, connect to it by typing: |wconnect <username> <password>|n To join the game, create a new account by typing: |wcreate <username> <password>|n |yThis is generally your character name.|n To just visit us with a temporary account, connect to it by typing: |wconnect guest|n We are running on |gEvennia version {}|n and using |gKumaRPG version {}.|n If you have spaces in your username, enclose it in quotes. Enter |whelp|n for more info. |wlook|n will re-show this screen. |113==============================================================================|n""".format( settings.SERVERNAME, settings.GAME_SLOGAN, utils.get_evennia_version("short"), settings.KUMAVERS)
""" Connection screen Texts in this module will be shown to the user at login-time. Evennia will look at global string variables (variables defined at the "outermost" scope of this module and use it as the connection screen. If there are more than one, Evennia will randomize which one it displays. The commands available to the user when the connection screen is shown are defined in commands.default_cmdsets. UnloggedinCmdSet and the screen is read and displayed by the unlogged-in "look" command. """ from django.conf import settings from evennia import utils CONNECTION_SCREEN = r""" Bienvenue sur l'ancien __ __ _ __ __ _ _ ____ \ \ / /_ _ _ __ ___(_) __ _| \/ | | | | _ \ \ \ / / _` | '_ \ / __| |/ _` | |\/| | | | | | | | \ V / (_| | | | | (__| | (_| | | | | |_| | |_| | \_/ \__,_|_| |_|\___|_|\__,_|_| |_|\___/|____/ Basé sur |gEvennia {}|n""" \ .format(utils.get_evennia_version())
To change the login screen in this module, do one of the following: - Define a function `connection_screen()`, taking no arguments. This will be called first and must return the full string to act as the connection screen. This can be used to produce more dynamic screens. - Alternatively, define a string variable in the outermost scope of this module with the connection string that should be displayed. If more than one such variable is given, Evennia will pick one of them at random. The commands available to the user when the connection screen is shown are defined in evennia.default_cmds.UnloggedinCmdSet. The parsing and display of the screen is done by the unlogged-in "look" command. """ from django.conf import settings from evennia import utils CONNECTION_SCREEN = """ |b==============================================================|n Welcome to |g{}|n, version {}! If you have an existing account, connect to it by typing: |wconnect <username> <password>|n If you need to create an account, type (without the <>'s): |wcreate <username> <password>|n Enter |whelp|n for more info. |wlook|n will re-show this screen. |b==============================================================|n""".format( settings.SERVERNAME, utils.get_evennia_version("short"))
Evennia will look at global string variables (variables defined at the "outermost" scope of this module and use it as the connection screen. If there are more than one, Evennia will randomize which one it displays. The commands available to the user when the connection screen is shown are defined in commands.default_cmdsets.UnloggedinCmdSet and the screen is read and displayed by the unlogged-in "look" command. """ from django.conf import settings from evennia import utils CONNECTION_SCREEN = \ """{b=============================================================={n Neighvada Nights v0.0.2A This game is STRICTLY 18+. If you are under the age of 18, disconnect immediately. If you have an existing account, connect to it by typing: {wconnect <username> <password>{n If you need to create an account, type (without the <>'s): {wcreate <username> <password>{n If you have spaces in your username, enclose it in quotes. Enter {whelp{n for more info. {wlook{n will re-show this screen. We are running Evennia version %s. {b=============================================================={n""" \ % (utils.get_evennia_version())
def audit(self, **kwargs): """ Extracts messages and system data from a Session object upon message send or receive. Kwargs: src (str): Source of data; 'client' or 'server'. Indicates direction. text (str or list): Client sends messages to server in the form of lists. Server sends messages to client as string. Returns: log (dict): Dictionary object containing parsed system and user data related to this message. """ # Get time at start of processing time_obj = timezone.now() time_str = str(time_obj) session = self src = kwargs.pop('src', '?') bytecount = 0 # Do not log empty lines if not kwargs: return {} # Get current session's IP address client_ip = session.address # Capture Account name and dbref together account = session.get_account() account_token = '' if account: account_token = '%s%s' % (account.key, account.dbref) # Capture Character name and dbref together char = session.get_puppet() char_token = '' if char: char_token = '%s%s' % (char.key, char.dbref) # Capture Room name and dbref together room = None room_token = '' if char: room = char.location room_token = '%s%s' % (room.key, room.dbref) # Try to compile an input/output string def drill(obj, bucket): if isinstance(obj, dict): return bucket elif utils.is_iter(obj): for sub_obj in obj: bucket.extend(drill(sub_obj, [])) else: bucket.append(obj) return bucket text = kwargs.pop('text', '') if utils.is_iter(text): text = '|'.join(drill(text, [])) # Mask any PII in message, where possible bytecount = len(text.encode('utf-8')) text = self.mask(text) # Compile the IP, Account, Character, Room, and the message. log = { 'time': time_str, 'hostname': socket.getfqdn(), 'application': '%s' % ev_settings.SERVERNAME, 'version': get_evennia_version(), 'pid': os.getpid(), 'direction': 'SND' if src == 'server' else 'RCV', 'protocol': self.protocol_key, 'ip': client_ip, 'session': 'session#%s' % self.sessid, 'account': account_token, 'character': char_token, 'room': room_token, 'text': text.strip(), 'bytes': bytecount, 'data': kwargs, 'objects': { 'time': time_obj, 'session': self, 'account': account, 'character': char, 'room': room, } } # Remove any keys with blank values if AUDIT_ALLOW_SPARSE is False: log['data'] = {k: v for k, v in log['data'].items() if v} log['objects'] = {k: v for k, v in log['objects'].items() if v} log = {k: v for k, v in log.items() if v} return log
from django.conf import settings from evennia import utils CONNECTION_PARTS = { 'default': """ |b==============================================================|n Welcome to |g{}|n, version {}! If you have an existing account, connect to it by typing: |wconnect <username> <password>|n If you need to create an account, type (without the <>'s): |wcreate <username> <password>|n If you have spaces in your username, enclose it in quotes. Enter |whelp|n for more info. |wlook|n will re-show this screen. |b==============================================================|n""" \ .format(settings.SERVERNAME, utils.get_evennia_version()), 'custom_divider': """ - .... . ..-. --- -..- .... --- .-.. . """, 'login_instructions_long': """ If you have an existing account, connect to it by typing: |wconnect <username> <password>|n If you need to create an account, type (without the <>'s): |wcreate <username> <password>|n""", 'login_footer': """ Please do not include spaces in your username. Enter |whelp|n for login info or |wlook|n to show this again.""", 'border_heavy': """|b==============================================================|n""", 'border_light': """|b--------------------------------------------------------------|n""", 'version_footer': """ server {} - game {}|n""" \ .format(utils.get_evennia_version(), 'tbd'), } CONNECTION_SCREEN = """ {top_border}
Evennia will look at global string variables (variables defined at the "outermost" scope of this module and use it as the connection screen. If there are more than one, Evennia will randomize which one it displays. The commands available to the user when the connection screen is shown are defined in commands.default_cmdsets.UnloggedinCmdSet and the screen is read and displayed by the unlogged-in "look" command. """ from django.conf import settings from evennia import utils CONNECTION_SCREEN = \ """|b==============================================================|n Welcome to the demo install of Evennia - |g%s|n, currently running version %s! This demo instance may reset without warning, in which case you will have to recreate your account. If you have an existing account, connect to it by typing: |wconnect <username> <password>|n If you need to create an account, type (without the <>'s): |wcreate <username> <password>|n Enter |whelp|n for more info. |wlook|n will re-show this screen. |b==============================================================|n""" \ % (settings.SERVERNAME, utils.get_evennia_version())
def audit(self, **kwargs): """ Extracts messages and system data from a Session object upon message send or receive. Kwargs: src (str): Source of data; 'client' or 'server'. Indicates direction. text (str or list): Client sends messages to server in the form of lists. Server sends messages to client as string. Returns: log (dict): Dictionary object containing parsed system and user data related to this message. """ # Get time at start of processing time_obj = timezone.now() time_str = str(time_obj) session = self src = kwargs.pop('src', '?') bytecount = 0 # Do not log empty lines if not kwargs: return {} # Get current session's IP address client_ip = session.address # Capture Account name and dbref together account = session.get_account() account_token = '' if account: account_token = '%s%s' % (account.key, account.dbref) # Capture Character name and dbref together char = session.get_puppet() char_token = '' if char: char_token = '%s%s' % (char.key, char.dbref) # Capture Room name and dbref together room = None room_token = '' if char: room = char.location room_token = '%s%s' % (room.key, room.dbref) # Try to compile an input/output string def drill(obj, bucket): if isinstance(obj, dict): return bucket elif utils.is_iter(obj): for sub_obj in obj: bucket.extend(drill(sub_obj, [])) else: bucket.append(obj) return bucket text = kwargs.pop('text', '') if utils.is_iter(text): text = '|'.join(drill(text, [])) # Mask any PII in message, where possible bytecount = len(text.encode('utf-8')) text = self.mask(text) # Compile the IP, Account, Character, Room, and the message. log = { 'time': time_str, 'hostname': socket.getfqdn(), 'application': '%s' % ev_settings.SERVERNAME, 'version': get_evennia_version(), 'pid': os.getpid(), 'direction': 'SND' if src == 'server' else 'RCV', 'protocol': self.protocol_key, 'ip': client_ip, 'session': 'session#%s' % self.sessid, 'account': account_token, 'character': char_token, 'room': room_token, 'text': text.strip(), 'bytes': bytecount, 'data': kwargs, 'objects': { 'time': time_obj, 'session': self, 'account': account, 'character': char, 'room': room, } } # Remove any keys with blank values if AUDIT_ALLOW_SPARSE is False: log['data'] = {k: v for k, v in log['data'].iteritems() if v} log['objects'] = {k: v for k, v in log['objects'].iteritems() if v} log = {k: v for k, v in log.iteritems() if v} return log
def audit(self, **kwargs): """ Extracts messages and system data from a Session object upon message send or receive. Kwargs: src (str): Source of data; 'client' or 'server'. Indicates direction. text (str or list): Client sends messages to server in the form of lists. Server sends messages to client as string. Returns: log (dict): Dictionary object containing parsed system and user data related to this message. """ # Get time at start of processing time_obj = timezone.now() time_str = str(time_obj) session = self src = kwargs.pop("src", "?") bytecount = 0 # Do not log empty lines if not kwargs: return {} # Get current session's IP address client_ip = session.address # Capture Account name and dbref together account = session.get_account() account_token = "" if account: account_token = "%s%s" % (account.key, account.dbref) # Capture Character name and dbref together char = session.get_puppet() char_token = "" if char: char_token = "%s%s" % (char.key, char.dbref) # Capture Room name and dbref together room = None room_token = "" if char: room = char.location room_token = "%s%s" % (room.key, room.dbref) # Try to compile an input/output string def drill(obj, bucket): if isinstance(obj, dict): return bucket elif utils.is_iter(obj): for sub_obj in obj: bucket.extend(drill(sub_obj, [])) else: bucket.append(obj) return bucket text = kwargs.pop("text", "") if utils.is_iter(text): text = "|".join(drill(text, [])) # Mask any PII in message, where possible bytecount = len(text.encode("utf-8")) text = self.mask(text) # Compile the IP, Account, Character, Room, and the message. log = { "time": time_str, "hostname": socket.getfqdn(), "application": "%s" % ev_settings.SERVERNAME, "version": get_evennia_version(), "pid": os.getpid(), "direction": "SND" if src == "server" else "RCV", "protocol": self.protocol_key, "ip": client_ip, "session": "session#%s" % self.sessid, "account": account_token, "character": char_token, "room": room_token, "text": text.strip(), "bytes": bytecount, "data": kwargs, "objects": { "time": time_obj, "session": self, "account": account, "character": char, "room": room, }, } # Remove any keys with blank values if AUDIT_ALLOW_SPARSE is False: log["data"] = {k: v for k, v in log["data"].items() if v} log["objects"] = {k: v for k, v in log["objects"].items() if v} log = {k: v for k, v in log.items() if v} return log
Texts in this module will be shown to the user at login-time. Evennia will look at global string variables (variables defined at the "outermost" scope of this module and use it as the connection screen. If there are more than one, Evennia will randomize which one it displays. The commands available to the user when the connection screen is shown are defined in commands.default_cmdsets.UnloggedinCmdSet and the screen is read and displayed by the unlogged-in "look" command. """ from django.conf import settings from evennia import utils CONNECTION_SCREEN = \ r"""Welcome to , /'/ /' / ,/' /. , ____ ,____ ____ . . , , /`--,/ | / /' ) /' ) /' )| |/ / /' / | /' /(___,/' /' /' /(___,/' | /| /' (,/' (_,_|/(__(________/' /(__(_________|/' |/(__ |gAvenew One|n, built on Evennia %s!""" \ % (utils.get_evennia_version())
connection screen. If there are more than one, Evennia will randomize which one it displays. The commands available to the user when the connection screen is shown are defined in commands.default_cmdsets.UnloggedinCmdSet and the screen is read and displayed by the unlogged-in "look" command. """ from django.conf import settings from evennia import utils CONNECTION_SCREEN = \ """|b==============================================================|n Welcome to the demo install of Evennia |g%s|n, currently running version %s! (generously hosted by Jarin at silvren.com - Thanks!) This demo instance may reset without warning, in which case you will have to recreate your account. If you have an existing account, connect to it by typing: |wconnect <username> <password>|n If you need to create an account, type (without the <>'s): |wcreate <username> <password>|n If you have spaces in your username, enclose it in quotes. Enter |whelp|n for more info. |wlook|n will re-show this screen. |b==============================================================|n""" \ % (settings.SERVERNAME, utils.get_evennia_version())
"""{b=============================================================={n Welcome to the test install of {gEvennia{n currently running version %s (generously hosted by Puciek - Thanks!) This demo instance may reset without warning, in which case you will have to recreate your account. If you have an existing account, connect to it by typing: {wconnect <username> <password>{n To create a new account, type (without the <>'s): {wcreate <username> <password>{n If you have spaces in your username, enclose it in quotes. Enter {whelp{n for more info. {wlook{n will re-show this screen. {b=============================================================={n""" % utils.get_evennia_version() # # Mux-like alternative screen for contrib/mux_login.py # MUX_SCREEN = \ # """{b=============================================================={n # Welcome to {gEvennia{n, version %s! # # If you have an existing account, connect to it by typing: # {wconnect <email> <password>{n # If you need to create an account, type (without the <>'s): # {wcreate \"<username>\" <email> <password>{n # # Enter {whelp{n for more info. {wlook{n will re-load this screen. #{b=============================================================={n""" % utils.get_evennia_version()