Modify package template
This commit is contained in:
parent
7fed14d233
commit
b1cae35e34
64 changed files with 307 additions and 446 deletions
|
|
@ -278,17 +278,18 @@ class SshProtocol(Manhole, _BASE_SESSION_CLASS):
|
|||
text (str): The first argument is always the text string to send. No other arguments
|
||||
are considered.
|
||||
Keyword args:
|
||||
options (dict): Send-option flags
|
||||
- mxp: Enforce MXP link support.
|
||||
- ansi: Enforce no ANSI colors.
|
||||
- xterm256: Enforce xterm256 colors, regardless of TTYPE setting.
|
||||
- nocolor: Strip all colors.
|
||||
- raw: Pass string through without any ansi processing
|
||||
(i.e. include Evennia ansi markers but do not
|
||||
convert them into ansi tokens)
|
||||
- echo: Turn on/off line echo on the client. Turn
|
||||
off line echo for client, for example for password.
|
||||
Note that it must be actively turned back on again!
|
||||
options (dict): Send-option flags (booleans)
|
||||
|
||||
- mxp: enforce mxp link support.
|
||||
- ansi: enforce no ansi colors.
|
||||
- xterm256: enforce xterm256 colors, regardless of ttype setting.
|
||||
- nocolor: strip all colors.
|
||||
- raw: pass string through without any ansi processing
|
||||
(i.e. include evennia ansi markers but do not
|
||||
convert them into ansi tokens)
|
||||
- echo: turn on/off line echo on the client. turn
|
||||
off line echo for client, for example for password.
|
||||
note that it must be actively turned back on again!
|
||||
|
||||
"""
|
||||
# print "telnet.send_text", args,kwargs # DEBUG
|
||||
|
|
|
|||
|
|
@ -386,17 +386,18 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, _BASE_SESSION_CLASS):
|
|||
are considered.
|
||||
Keyword args:
|
||||
options (dict): Send-option flags
|
||||
- mxp: Enforce MXP link support.
|
||||
- ansi: Enforce no ANSI colors.
|
||||
- xterm256: Enforce xterm256 colors, regardless of TTYPE.
|
||||
- noxterm256: Enforce no xterm256 color support, regardless of TTYPE.
|
||||
- nocolor: Strip all Color, regardless of ansi/xterm256 setting.
|
||||
- raw: Pass string through without any ansi processing
|
||||
(i.e. include Evennia ansi markers but do not
|
||||
convert them into ansi tokens)
|
||||
- echo: Turn on/off line echo on the client. Turn
|
||||
off line echo for client, for example for password.
|
||||
Note that it must be actively turned back on again!
|
||||
|
||||
- mxp: Enforce MXP link support.
|
||||
- ansi: Enforce no ANSI colors.
|
||||
- xterm256: Enforce xterm256 colors, regardless of TTYPE.
|
||||
- noxterm256: Enforce no xterm256 color support, regardless of TTYPE.
|
||||
- nocolor: Strip all Color, regardless of ansi/xterm256 setting.
|
||||
- raw: Pass string through without any ansi processing
|
||||
(i.e. include Evennia ansi markers but do not
|
||||
convert them into ansi tokens)
|
||||
- echo: Turn on/off line echo on the client. Turn
|
||||
off line echo for client, for example for password.
|
||||
Note that it must be actively turned back on again!
|
||||
|
||||
"""
|
||||
text = args[0] if args else ""
|
||||
|
|
|
|||
|
|
@ -10,15 +10,15 @@ how and if they are handled. Examples of OOB instructions could be to
|
|||
instruct the client to play sounds or to update a graphical health
|
||||
bar.
|
||||
|
||||
> Note that in Evennia's Web client, all send commands are "OOB
|
||||
Note that in Evennia's Web client, all send commands are "OOB
|
||||
commands", (including the "text" one), there is no equivalence to
|
||||
MSDP/GMCP for the webclient since it doesn't need it.
|
||||
|
||||
This implements the following telnet OOB communication protocols:
|
||||
- MSDP (Mud Server Data Protocol), as per
|
||||
http://tintin.sourceforge.net/msdp/
|
||||
|
||||
- MSDP (Mud Server Data Protocol), as per http://tintin.sourceforge.net/msdp/
|
||||
- GMCP (Generic Mud Communication Protocol) as per
|
||||
http://www.ironrealms.com/rapture/manual/files/FeatGMCP-txt.html#Generic_MUD_Communication_Protocol%28GMCP%29
|
||||
http://www.ironrealms.com/rapture/manual/files/FeatGMCP-txt.html#Generic_MUD_Communication_Protocol%28GMCP%29
|
||||
|
||||
Following the lead of KaVir's protocol snippet, we first check if
|
||||
client supports MSDP and if not, we fallback to GMCP with a MSDP
|
||||
|
|
@ -156,13 +156,14 @@ class TelnetOOB(object):
|
|||
Notes:
|
||||
The output of this encoding will be
|
||||
MSDP structures on these forms:
|
||||
::
|
||||
|
||||
[cmdname, [], {}] -> VAR cmdname VAL ""
|
||||
[cmdname, [arg], {}] -> VAR cmdname VAL arg
|
||||
[cmdname, [args],{}] -> VAR cmdname VAL ARRAYOPEN VAL arg VAL arg ... ARRAYCLOSE
|
||||
[cmdname, [], {kwargs}] -> VAR cmdname VAL TABLEOPEN VAR key VAL val ... TABLECLOSE
|
||||
[cmdname, [args], {kwargs}] -> VAR cmdname VAL ARRAYOPEN VAL arg VAL arg ... ARRAYCLOSE
|
||||
VAR cmdname VAL TABLEOPEN VAR key VAL val ... TABLECLOSE
|
||||
[cmdname, [], {}] -> VAR cmdname VAL ""
|
||||
[cmdname, [arg], {}] -> VAR cmdname VAL arg
|
||||
[cmdname, [args],{}] -> VAR cmdname VAL ARRAYOPEN VAL arg VAL arg ... ARRAYCLOSE
|
||||
[cmdname, [], {kwargs}] -> VAR cmdname VAL TABLEOPEN VAR key VAL val ... TABLECLOSE
|
||||
[cmdname, [args], {kwargs}] -> VAR cmdname VAL ARRAYOPEN VAL arg VAL arg ... ARRAYCLOSE
|
||||
VAR cmdname VAL TABLEOPEN VAR key VAL val ... TABLECLOSE
|
||||
|
||||
Further nesting is not supported, so if an array argument
|
||||
consists of an array (for example), that array will be
|
||||
|
|
@ -230,16 +231,18 @@ class TelnetOOB(object):
|
|||
to have adopted). A cmdname without Package will end
|
||||
up in the Core package, while Core package names will
|
||||
be stripped on the Evennia side.
|
||||
::
|
||||
|
||||
[cmd.name, [], {}] -> Cmd.Name
|
||||
[cmd.name, [arg], {}] -> Cmd.Name arg
|
||||
[cmd.name, [args],{}] -> Cmd.Name [args]
|
||||
[cmd.name, [], {kwargs}] -> Cmd.Name {kwargs}
|
||||
[cmdname, [args, {kwargs}] -> Core.Cmdname [[args],{kwargs}]
|
||||
[cmd.name, [], {}] -> Cmd.Name
|
||||
[cmd.name, [arg], {}] -> Cmd.Name arg
|
||||
[cmd.name, [args],{}] -> Cmd.Name [args]
|
||||
[cmd.name, [], {kwargs}] -> Cmd.Name {kwargs}
|
||||
[cmdname, [args, {kwargs}] -> Core.Cmdname [[args],{kwargs}]
|
||||
|
||||
Notes:
|
||||
There are also a few default mappings between evennia outputcmds and
|
||||
GMCP:
|
||||
There are also a few default mappings between evennia outputcmds and GMCP:
|
||||
::
|
||||
|
||||
client_options -> Core.Supports.Get
|
||||
get_inputfuncs -> Core.Commands.Get
|
||||
get_value -> Char.Value.Get
|
||||
|
|
@ -280,12 +283,13 @@ class TelnetOOB(object):
|
|||
Notes:
|
||||
Clients should always send MSDP data on
|
||||
one of the following forms:
|
||||
::
|
||||
|
||||
cmdname '' -> [cmdname, [], {}]
|
||||
cmdname val -> [cmdname, [val], {}]
|
||||
cmdname array -> [cmdname, [array], {}]
|
||||
cmdname table -> [cmdname, [], {table}]
|
||||
cmdname array cmdname table -> [cmdname, [array], {table}]
|
||||
cmdname '' -> [cmdname, [], {}]
|
||||
cmdname val -> [cmdname, [val], {}]
|
||||
cmdname array -> [cmdname, [array], {}]
|
||||
cmdname table -> [cmdname, [], {table}]
|
||||
cmdname array cmdname table -> [cmdname, [array], {table}]
|
||||
|
||||
Observe that all MSDP_VARS are used to identify cmdnames,
|
||||
so if there are multiple arrays with the same cmdname
|
||||
|
|
@ -379,12 +383,13 @@ class TelnetOOB(object):
|
|||
We assume the structure is valid JSON.
|
||||
|
||||
The following is parsed into Evennia's formal structure:
|
||||
::
|
||||
|
||||
Core.Name -> [name, [], {}]
|
||||
Core.Name string -> [name, [string], {}]
|
||||
Core.Name [arg, arg,...] -> [name, [args], {}]
|
||||
Core.Name {key:arg, key:arg, ...} -> [name, [], {kwargs}]
|
||||
Core.Name [[args], {kwargs}] -> [name, [args], {kwargs}]
|
||||
Core.Name -> [name, [], {}]
|
||||
Core.Name string -> [name, [string], {}]
|
||||
Core.Name [arg, arg,...] -> [name, [args], {}]
|
||||
Core.Name {key:arg, key:arg, ...} -> [name, [], {kwargs}]
|
||||
Core.Name [[args], {kwargs}] -> [name, [args], {kwargs}]
|
||||
|
||||
"""
|
||||
if isinstance(data, list):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
Dummyrunner
|
||||
# Dummyrunner
|
||||
|
||||
This is a test system for stress-testing the server. It will launch numbers
|
||||
of "dummy players" to connect to the server and do various sequences of actions.
|
||||
|
|
@ -6,15 +6,17 @@ the actions available to dummy accounts.
|
|||
|
||||
The settings are global variables:
|
||||
|
||||
TIMESTEP - time in seconds between each 'tick'
|
||||
CHANCE_OF_ACTION - chance 0-1 of action happening
|
||||
CHANCE_OF_LOGIN - chance 0-1 of login happening
|
||||
TELNET_PORT - port to use, defaults to settings.TELNET_PORT
|
||||
ACTIONS - see below
|
||||
- TIMESTEP - time in seconds between each 'tick'
|
||||
- CHANCE_OF_ACTION - chance 0-1 of action happening
|
||||
- CHANCE_OF_LOGIN - chance 0-1 of login happening
|
||||
- TELNET_PORT - port to use, defaults to settings.TELNET_PORT
|
||||
- ACTIONS - see below
|
||||
|
||||
ACTIONS is a tuple
|
||||
|
||||
```python
|
||||
(login_func, logout_func, (0.3, func1), (0.1, func2) ... )
|
||||
```
|
||||
|
||||
where the first entry is the function to call on first connect, with a
|
||||
chance of occurring given by CHANCE_OF_LOGIN. This function is usually
|
||||
|
|
@ -33,15 +35,16 @@ returns a string or a list of command strings to execute. Use the
|
|||
client object for optionally saving data between actions.
|
||||
|
||||
The client object has the following relevant properties and methods:
|
||||
key - an optional client key. This is only used for dummyrunner output.
|
||||
Default is "Dummy-<cid>"
|
||||
cid - client id
|
||||
gid - globally unique id, hashed with time stamp
|
||||
istep - the current step
|
||||
exits - an empty list. Can be used to store exit names
|
||||
objs - an empty list. Can be used to store object names
|
||||
counter() - returns a unique increasing id, hashed with time stamp
|
||||
to make it unique also between dummyrunner instances.
|
||||
|
||||
- key - an optional client key. This is only used for dummyrunner output.
|
||||
Default is "Dummy-<cid>"
|
||||
- cid - client id
|
||||
- gid - globally unique id, hashed with time stamp
|
||||
- istep - the current step
|
||||
- exits - an empty list. Can be used to store exit names
|
||||
- objs - an empty list. Can be used to store object names
|
||||
- counter() - returns a unique increasing id, hashed with time stamp
|
||||
to make it unique also between dummyrunner instances.
|
||||
|
||||
The return should either be a single command string or a tuple of
|
||||
command strings. This list of commands will always be executed every
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
"""
|
||||
This module implements the main Evennia server process, the core of
|
||||
the game engine.
|
||||
This module implements the main Evennia server process, the core of the game
|
||||
engine.
|
||||
|
||||
This module should be started with the 'twistd' executable since it
|
||||
sets up all the networking features. (this is done automatically
|
||||
by evennia/server/server_runner.py).
|
||||
This module should be started with the 'twistd' executable since it sets up all
|
||||
the networking features. (this is done automatically by
|
||||
evennia/server/server_runner.py).
|
||||
|
||||
"""
|
||||
import time
|
||||
|
|
@ -401,16 +401,16 @@ class Evennia(object):
|
|||
Shuts down the server from inside it.
|
||||
|
||||
mode - sets the server restart mode.
|
||||
'reload' - server restarts, no "persistent" scripts
|
||||
are stopped, at_reload hooks called.
|
||||
'reset' - server restarts, non-persistent scripts stopped,
|
||||
at_shutdown hooks called but sessions will not
|
||||
be disconnected.
|
||||
'shutdown' - like reset, but server will not auto-restart.
|
||||
- 'reload' - server restarts, no "persistent" scripts
|
||||
are stopped, at_reload hooks called.
|
||||
- 'reset' - server restarts, non-persistent scripts stopped,
|
||||
at_shutdown hooks called but sessions will not
|
||||
be disconnected.
|
||||
- 'shutdown' - like reset, but server will not auto-restart.
|
||||
_reactor_stopping - this is set if server is stopped by a kill
|
||||
command OR this method was already called
|
||||
once - in both cases the reactor is
|
||||
dead/stopping already.
|
||||
command OR this method was already called
|
||||
once - in both cases the reactor is
|
||||
dead/stopping already.
|
||||
"""
|
||||
if _reactor_stopping and hasattr(self, "shutdown_complete"):
|
||||
# this means we have already passed through this method
|
||||
|
|
|
|||
|
|
@ -746,6 +746,7 @@ class ServerSessionHandler(SessionHandler):
|
|||
|
||||
Args
|
||||
csessid (str): The session hash.
|
||||
|
||||
Returns:
|
||||
sessions (list): The sessions with matching .csessid, if any.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue