mirror of
https://github.com/evennia/evennia.git
synced 2026-03-27 18:26:32 +01:00
Updated commands to use new evennia path.
This commit is contained in:
parent
6a8e57b2a1
commit
3ff937a6fd
22 changed files with 133 additions and 140 deletions
|
|
@ -40,10 +40,10 @@ from copy import copy
|
|||
from traceback import format_exc
|
||||
from twisted.internet.defer import inlineCallbacks, returnValue
|
||||
from django.conf import settings
|
||||
from src.comms.channelhandler import CHANNELHANDLER
|
||||
from src.utils import logger, utils
|
||||
from src.commands.cmdparser import at_multimatch_cmd
|
||||
from src.utils.utils import string_suggestions, to_unicode
|
||||
from evennia.comms.channelhandler import CHANNELHANDLER
|
||||
from evennia.utils import logger, utils
|
||||
from evennia.commands.cmdparser import at_multimatch_cmd
|
||||
from evennia.utils.utils import string_suggestions, to_unicode
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ replacing cmdparser function. The replacement parser must matches
|
|||
on the sme form as the default cmdparser.
|
||||
"""
|
||||
|
||||
from src.utils.logger import log_trace
|
||||
from django.utils.translation import ugettext as _
|
||||
from evennia.utils.logger import log_trace
|
||||
|
||||
def cmdparser(raw_string, cmdset, caller, match_index=None):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ together to create interesting in-game effects.
|
|||
|
||||
from weakref import WeakKeyDictionary
|
||||
from django.utils.translation import ugettext as _
|
||||
from src.utils.utils import inherits_from, is_iter
|
||||
from evennia.utils.utils import inherits_from, is_iter
|
||||
__all__ = ("CmdSet",)
|
||||
|
||||
|
||||
|
|
@ -345,7 +345,7 @@ class CmdSet(object):
|
|||
existing ones to make a unique set.
|
||||
"""
|
||||
|
||||
if inherits_from(cmd, "src.commands.cmdset.CmdSet"):
|
||||
if inherits_from(cmd, "evennia.commands.cmdset.CmdSet"):
|
||||
# cmd is a command set so merge all commands in that set
|
||||
# to this one. We raise a visible error if we created
|
||||
# an infinite loop (adding cmdset to itself somehow)
|
||||
|
|
|
|||
|
|
@ -64,9 +64,9 @@ example, you can have a 'On a boat' set, onto which you then tack on
|
|||
the 'Fishing' set. Fishing from a boat? No problem!
|
||||
"""
|
||||
from django.conf import settings
|
||||
from src.utils import logger, utils
|
||||
from src.commands.cmdset import CmdSet
|
||||
from src.server.models import ServerConfig
|
||||
from evennia.utils import logger, utils
|
||||
from evennia.commands.cmdset import CmdSet
|
||||
from evennia.server.models import ServerConfig
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
__all__ = ("import_cmdset", "CmdSetHandler")
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ All commands in Evennia inherit from the 'Command' class in this module.
|
|||
"""
|
||||
|
||||
import re
|
||||
from src.locks.lockhandler import LockHandler
|
||||
from src.utils.utils import is_iter, fill, lazy_property
|
||||
from evennia.locks.lockhandler import LockHandler
|
||||
from evennia.utils.utils import is_iter, fill, lazy_property
|
||||
|
||||
|
||||
def _init_command(mcs, **kwargs):
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#
|
||||
# This is Evennia's default connection screen. It is imported
|
||||
# and run from game/gamesrc/world/connection_screens.py.
|
||||
# and run from world/connection_screens.py.
|
||||
#
|
||||
|
||||
from django.conf import settings
|
||||
from src.utils import utils
|
||||
from evennia.utils import utils
|
||||
|
||||
DEFAULT_SCREEN = \
|
||||
"""{b=============================================================={n
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ Admin commands
|
|||
import time
|
||||
import re
|
||||
from django.conf import settings
|
||||
from src.server.sessionhandler import SESSIONS
|
||||
from src.server.models import ServerConfig
|
||||
from src.utils import prettytable, search
|
||||
from src.commands.default.muxcommand import MuxCommand
|
||||
from evennia.server.sessionhandler import SESSIONS
|
||||
from evennia.server.models import ServerConfig
|
||||
from evennia.utils import prettytable, search
|
||||
from evennia.commands.default.muxcommand import MuxCommand
|
||||
|
||||
PERMISSION_HIERARCHY = [p.lower() for p in settings.PERMISSION_HIERARCHY]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Batch processors
|
||||
|
||||
These commands implements the 'batch-command' and 'batch-code'
|
||||
processors, using the functionality in src.utils.batchprocessors.
|
||||
processors, using the functionality in evennia.utils.batchprocessors.
|
||||
They allow for offline world-building.
|
||||
|
||||
Batch-command is the simpler system. This reads a file (*.ev)
|
||||
|
|
@ -10,23 +10,19 @@ containing a list of in-game commands and executes them in sequence as
|
|||
if they had been entered in the game (including permission checks
|
||||
etc).
|
||||
|
||||
Example batch-command file: game/gamesrc/commands/examples/batch_cmds.ev
|
||||
|
||||
Batch-code is a full-fledged python code interpreter that reads blocks
|
||||
of python code (*.py) and executes them in sequence. This allows for
|
||||
much more power than Batch-command, but requires knowing Python and
|
||||
the Evennia API. It is also a severe security risk and should
|
||||
therefore always be limited to superusers only.
|
||||
|
||||
Example batch-code file: game/gamesrc/commands/examples/batch_code.py
|
||||
|
||||
"""
|
||||
from traceback import format_exc
|
||||
from django.conf import settings
|
||||
from src.utils.batchprocessors import BATCHCMD, BATCHCODE
|
||||
from src.commands.cmdset import CmdSet
|
||||
from src.commands.default.muxcommand import MuxCommand
|
||||
from src.utils import utils
|
||||
from evennia.utils.batchprocessors import BATCHCMD, BATCHCODE
|
||||
from evennia.commands.cmdset import CmdSet
|
||||
from evennia.commands.default.muxcommand import MuxCommand
|
||||
from evennia.utils import utils
|
||||
|
||||
# limit symbols for API inclusion
|
||||
__all__ = ("CmdBatchCommands", "CmdBatchCode")
|
||||
|
|
@ -51,7 +47,7 @@ _UTF8_ERROR = \
|
|||
"""
|
||||
|
||||
_PROCPOOL_BATCHCMD_SOURCE = """
|
||||
from src.commands.default.batchprocess import batch_cmd_exec, step_pointer, BatchSafeCmdSet
|
||||
from evennia.commands.default.batchprocess import batch_cmd_exec, step_pointer, BatchSafeCmdSet
|
||||
caller.ndb.batch_stack = commands
|
||||
caller.ndb.batch_stackptr = 0
|
||||
caller.ndb.batch_batchmode = "batch_commands"
|
||||
|
|
@ -65,7 +61,7 @@ for inum in range(len(commands)):
|
|||
print "leaving run ..."
|
||||
"""
|
||||
_PROCPOOL_BATCHCODE_SOURCE = """
|
||||
from src.commands.default.batchprocess import batch_code_exec, step_pointer, BatchSafeCmdSet
|
||||
from evennia.commands.default.batchprocess import batch_code_exec, step_pointer, BatchSafeCmdSet
|
||||
caller.ndb.batch_stack = codes
|
||||
caller.ndb.batch_stackptr = 0
|
||||
caller.ndb.batch_batchmode = "batch_code"
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ Building and world design commands
|
|||
"""
|
||||
from django.conf import settings
|
||||
from django.db.models import Q
|
||||
from src.objects.models import ObjectDB
|
||||
from src.locks.lockhandler import LockException
|
||||
from src.commands.default.muxcommand import MuxCommand
|
||||
from src.commands.cmdhandler import get_and_merge_cmdsets
|
||||
from src.utils import create, utils, search
|
||||
from src.utils.utils import inherits_from
|
||||
from src.utils.spawner import spawn
|
||||
from src.utils.ansi import raw
|
||||
from evennia.objects.models import ObjectDB
|
||||
from evennia.locks.lockhandler import LockException
|
||||
from evennia.commands.default.muxcommand import MuxCommand
|
||||
from evennia.commands.cmdhandler import get_and_merge_cmdsets
|
||||
from evennia.utils import create, utils, search
|
||||
from evennia.utils.utils import inherits_from
|
||||
from evennia.utils.spawner import spawn
|
||||
from evennia.utils.ansi import raw
|
||||
|
||||
# limit symbol import for API
|
||||
__all__ = ("ObjManipCommand", "CmdSetObjAlias", "CmdCopy",
|
||||
|
|
@ -404,10 +404,10 @@ class CmdCreate(ObjManipCommand):
|
|||
|
||||
Creates one or more new objects. If typeclass is given, the object
|
||||
is created as a child of this typeclass. The typeclass script is
|
||||
assumed to be located under game/gamesrc/objects and any further
|
||||
assumed to be located under types/ and any further
|
||||
directory structure is given in Python notation. So if you have a
|
||||
correct typeclass 'RedButton' defined in
|
||||
game/gamesrc/objects/examples/red_button.py, you could create a new
|
||||
types/examples/red_button.py, you could create a new
|
||||
object of this type like this:
|
||||
|
||||
@create/drop button;red : examples.red_button.RedButton
|
||||
|
|
@ -1814,7 +1814,7 @@ class CmdExamine(ObjManipCommand):
|
|||
obj_name = objdef['name']
|
||||
obj_attrs = objdef['attrs']
|
||||
|
||||
self.player_mode = utils.inherits_from(caller, "src.players.player.Player") or \
|
||||
self.player_mode = utils.inherits_from(caller, "evennia.players.player.Player") or \
|
||||
"player" in self.switches or obj_name.startswith('*')
|
||||
if self.player_mode:
|
||||
try:
|
||||
|
|
@ -2123,7 +2123,7 @@ class CmdScript(MuxCommand):
|
|||
string += "No scripts defined on %s." % obj.key
|
||||
elif not self.switches:
|
||||
# view all scripts
|
||||
from src.commands.default.system import format_script_list
|
||||
from evennia.commands.default.system import format_script_list
|
||||
string += format_script_list(scripts)
|
||||
elif "start" in self.switches:
|
||||
num = sum([obj.scripts.start(script.key) for script in scripts])
|
||||
|
|
@ -2277,11 +2277,8 @@ class CmdTag(MuxCommand):
|
|||
self.caller.msg(string)
|
||||
|
||||
#
|
||||
# To use the prototypes with the @spawn function, copy
|
||||
# game/gamesrc/world/examples/prototypes.py up one level
|
||||
# to game/gamesrc/world. Then add to game/settings.py the
|
||||
# line
|
||||
# PROTOTYPE_MODULES = ["game.gamesrc.commands.prototypes"]
|
||||
# To use the prototypes with the @spawn function set
|
||||
# PROTOTYPE_MODULES = ["commands.prototypes"]
|
||||
# Reload the server and the prototypes should be available.
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ available (i.e. IC commands). Note that some commands, such as
|
|||
communication-commands are instead put on the player level, in the
|
||||
Player cmdset. Player commands remain available also to Characters.
|
||||
"""
|
||||
from src.commands.cmdset import CmdSet
|
||||
from src.commands.default import general, help, admin, system
|
||||
from src.commands.default import building
|
||||
from src.commands.default import batchprocess
|
||||
from evennia.commands.cmdset import CmdSet
|
||||
from evennia.commands.default import general, help, admin, system
|
||||
from evennia.commands.default import building
|
||||
from evennia.commands.default import batchprocess
|
||||
|
||||
|
||||
class CharacterCmdSet(CmdSet):
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ function, all commands in this cmdset should use the self.msg()
|
|||
command method rather than caller.msg().
|
||||
"""
|
||||
|
||||
from src.commands.cmdset import CmdSet
|
||||
from src.commands.default import help, comms, admin, system
|
||||
from src.commands.default import building, player
|
||||
from evennia.commands.cmdset import CmdSet
|
||||
from evennia.commands.default import help, comms, admin, system
|
||||
from evennia.commands.default import building, player
|
||||
|
||||
|
||||
class PlayerCmdSet(CmdSet):
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
"""
|
||||
This module stores session-level commands.
|
||||
"""
|
||||
from src.commands.cmdset import CmdSet
|
||||
from src.commands.default import player
|
||||
from evennia.commands.cmdset import CmdSet
|
||||
from evennia.commands.default import player
|
||||
|
||||
class SessionCmdSet(CmdSet):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ This module describes the unlogged state of the default game.
|
|||
The setting STATE_UNLOGGED should be set to the python path
|
||||
of the state instance in this module.
|
||||
"""
|
||||
from src.commands.cmdset import CmdSet
|
||||
from src.commands.default import unloggedin
|
||||
from evennia.commands.cmdset import CmdSet
|
||||
from evennia.commands.default import unloggedin
|
||||
|
||||
|
||||
class UnloggedinCmdSet(CmdSet):
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@ for easy handling.
|
|||
|
||||
"""
|
||||
from django.conf import settings
|
||||
from src.comms.models import ChannelDB, Msg
|
||||
#from src.comms import irc, imc2, rss
|
||||
from src.players.models import PlayerDB
|
||||
from src.players import bots
|
||||
from src.comms.channelhandler import CHANNELHANDLER
|
||||
from src.utils import create, utils, prettytable, evtable
|
||||
from src.utils.utils import make_iter
|
||||
from src.commands.default.muxcommand import MuxCommand, MuxPlayerCommand
|
||||
from evennia.comms.models import ChannelDB, Msg
|
||||
#from evennia.comms import irc, imc2, rss
|
||||
from evennia.players.models import PlayerDB
|
||||
from evennia.players import bots
|
||||
from evennia.comms.channelhandler import CHANNELHANDLER
|
||||
from evennia.utils import create, utils, prettytable, evtable
|
||||
from evennia.utils.utils import make_iter
|
||||
from evennia.commands.default.muxcommand import MuxCommand, MuxPlayerCommand
|
||||
|
||||
# limit symbol import for API
|
||||
__all__ = ("CmdAddCom", "CmdDelCom", "CmdAllCom",
|
||||
|
|
@ -794,7 +794,7 @@ class CmdIRC2Chan(MuxCommand):
|
|||
# show all connections
|
||||
ircbots = [bot for bot in PlayerDB.objects.filter(db_is_bot=True, username__startswith="ircbot-")]
|
||||
if ircbots:
|
||||
from src.utils.evtable import EvTable
|
||||
from evennia.utils.evtable import EvTable
|
||||
table = EvTable("{wdbid{n", "{wbotname{n", "{wev-channel{n", "{wirc-channel{n", maxwidth=78)
|
||||
for ircbot in ircbots:
|
||||
ircinfo = "%s (%s:%s)" % (ircbot.db.irc_channel, ircbot.db.irc_network, ircbot.db.irc_port)
|
||||
|
|
@ -903,7 +903,7 @@ class CmdRSS2Chan(MuxCommand):
|
|||
# show all connections
|
||||
rssbots = [bot for bot in PlayerDB.objects.filter(db_is_bot=True, username__startswith="rssbot-")]
|
||||
if rssbots:
|
||||
from src.utils.evtable import EvTable
|
||||
from evennia.utils.evtable import EvTable
|
||||
table = EvTable("{wdbid{n", "{wupdate rate{n", "{wev-channel", "{wRSS feed URL{n", border="cells", maxwidth=78)
|
||||
for rssbot in rssbots:
|
||||
table.add_row(rssbot.id, rssbot.db.rss_rate, rssbot.db.ev_channel, rssbot.db.rss_url)
|
||||
|
|
@ -1061,8 +1061,8 @@ class CmdRSS2Chan(MuxCommand):
|
|||
# if "update" in self.switches:
|
||||
# # update the lists
|
||||
# import time
|
||||
# from src.comms.imc2lib import imc2_packets as pck
|
||||
# from src.comms.imc2 import IMC2_MUDLIST, IMC2_CHANLIST, IMC2_CLIENT
|
||||
# from evennia.comms.imc2lib import imc2_packets as pck
|
||||
# from evennia.comms.imc2 import IMC2_MUDLIST, IMC2_CHANLIST, IMC2_CLIENT
|
||||
# # update connected muds
|
||||
# IMC2_CLIENT.send_packet(pck.IMC2PacketKeepAliveRequest())
|
||||
# # prune inactive muds
|
||||
|
|
@ -1076,7 +1076,7 @@ class CmdRSS2Chan(MuxCommand):
|
|||
# elif("games" in self.switches or "muds" in self.switches
|
||||
# or self.cmdstring == "@imclist"):
|
||||
# # list muds
|
||||
# from src.comms.imc2 import IMC2_MUDLIST
|
||||
# from evennia.comms.imc2 import IMC2_MUDLIST
|
||||
#
|
||||
# muds = IMC2_MUDLIST.get_mud_list()
|
||||
# networks = set(mud.networkname for mud in muds)
|
||||
|
|
@ -1096,7 +1096,7 @@ class CmdRSS2Chan(MuxCommand):
|
|||
# if not self.args:
|
||||
# self.msg("Usage: @imcwhois <playername>")
|
||||
# return
|
||||
# from src.comms.imc2 import IMC2_CLIENT
|
||||
# from evennia.comms.imc2 import IMC2_CLIENT
|
||||
# self.msg("Sending IMC whois request. If you receive no response, no matches were found.")
|
||||
# IMC2_CLIENT.msg_imc2(None,
|
||||
# from_obj=self.caller,
|
||||
|
|
@ -1106,7 +1106,7 @@ class CmdRSS2Chan(MuxCommand):
|
|||
# elif(not self.switches or "channels" in self.switches or
|
||||
# self.cmdstring == "@imcchanlist"):
|
||||
# # show channels
|
||||
# from src.comms.imc2 import IMC2_CHANLIST, IMC2_CLIENT
|
||||
# from evennia.comms.imc2 import IMC2_CHANLIST, IMC2_CLIENT
|
||||
#
|
||||
# channels = IMC2_CHANLIST.get_channel_list()
|
||||
# string = ""
|
||||
|
|
@ -1151,7 +1151,7 @@ class CmdRSS2Chan(MuxCommand):
|
|||
# self.msg(string)
|
||||
# return
|
||||
#
|
||||
# from src.comms.imc2 import IMC2_CLIENT
|
||||
# from evennia.comms.imc2 import IMC2_CLIENT
|
||||
#
|
||||
# if not self.args or not '@' in self.lhs or not self.rhs:
|
||||
# string = "Usage: imctell User@Mud = <msg>"
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
General Character commands usually availabe to all characters
|
||||
"""
|
||||
from django.conf import settings
|
||||
from src.utils import utils, prettytable
|
||||
from src.commands.default.muxcommand import MuxCommand
|
||||
from evennia.utils import utils, prettytable
|
||||
from evennia.commands.default.muxcommand import MuxCommand
|
||||
|
||||
|
||||
# limit symbol import for API
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ creation of other help topics such as RP help or game-world aides.
|
|||
"""
|
||||
|
||||
from collections import defaultdict
|
||||
from src.utils.utils import fill, dedent
|
||||
from src.commands.command import Command
|
||||
from src.help.models import HelpEntry
|
||||
from src.utils import create
|
||||
from src.utils.utils import string_suggestions
|
||||
from src.commands.default.muxcommand import MuxCommand
|
||||
from evennia.utils.utils import fill, dedent
|
||||
from evennia.commands.command import Command
|
||||
from evennia.help.models import HelpEntry
|
||||
from evennia.utils import create
|
||||
from evennia.utils.utils import string_suggestions
|
||||
from evennia.commands.default.muxcommand import MuxCommand
|
||||
|
||||
# limit symbol import for API
|
||||
__all__ = ("CmdHelp", "CmdSetHelp")
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ The command template for the default MUX-style command set. There
|
|||
is also an Player/OOC version that makes sure caller is a Player object.
|
||||
"""
|
||||
|
||||
from src.utils import utils
|
||||
from src.commands.command import Command
|
||||
from evennia.utils import utils
|
||||
from evennia.commands.command import Command
|
||||
|
||||
# limit symbol import for API
|
||||
__all__ = ("MuxCommand", "MuxPlayerCommand")
|
||||
|
|
@ -183,11 +183,11 @@ class MuxPlayerCommand(MuxCommand):
|
|||
"""
|
||||
super(MuxPlayerCommand, self).parse()
|
||||
|
||||
if utils.inherits_from(self.caller, "src.objects.objects.DefaultObject"):
|
||||
if utils.inherits_from(self.caller, "evennia.objects.objects.DefaultObject"):
|
||||
# caller is an Object/Character
|
||||
self.character = self.caller
|
||||
self.caller = self.caller.player
|
||||
elif utils.inherits_from(self.caller, "src.players.players.DefaultPlayer"):
|
||||
elif utils.inherits_from(self.caller, "evennia.players.players.DefaultPlayer"):
|
||||
# caller was already a Player
|
||||
self.character = self.caller.get_puppet(self.sessid)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ method. Otherwise all text will be returned to all connected sessions.
|
|||
"""
|
||||
import time
|
||||
from django.conf import settings
|
||||
from src.server.sessionhandler import SESSIONS
|
||||
from src.commands.default.muxcommand import MuxPlayerCommand
|
||||
from src.utils import utils, create, search, prettytable
|
||||
from evennia.server.sessionhandler import SESSIONS
|
||||
from evennia.commands.default.muxcommand import MuxPlayerCommand
|
||||
from evennia.utils import utils, create, search, prettytable
|
||||
|
||||
from settings import MAX_NR_CHARACTERS, MULTISESSION_MODE
|
||||
# limit symbol import for API
|
||||
|
|
@ -141,7 +141,7 @@ class CmdOOCLook(MuxPlayerCommand):
|
|||
string = "You are out-of-character (OOC).\nUse {w@ic{n to get back into the game."
|
||||
self.msg(string)
|
||||
return
|
||||
if utils.inherits_from(self.caller, "src.objects.objects.Object"):
|
||||
if utils.inherits_from(self.caller, "evennia.objects.objects.Object"):
|
||||
# An object of some type is calling. Use default look instead.
|
||||
super(CmdOOCLook, self).func()
|
||||
elif self.args:
|
||||
|
|
@ -180,7 +180,7 @@ class CmdCharCreate(MuxPlayerCommand):
|
|||
self.msg("You may only create a maximum of %i characters." % MAX_NR_CHARACTERS)
|
||||
return
|
||||
# create the character
|
||||
from src.objects.models import ObjectDB
|
||||
from evennia.objects.models import ObjectDB
|
||||
|
||||
start_location = ObjectDB.objects.get_id(settings.START_LOCATION)
|
||||
default_home = ObjectDB.objects.get_id(settings.DEFAULT_HOME)
|
||||
|
|
@ -596,7 +596,7 @@ class CmdColorTest(MuxPlayerCommand):
|
|||
|
||||
if self.args.startswith("a"):
|
||||
# show ansi 16-color table
|
||||
from src.utils import ansi
|
||||
from evennia.utils import ansi
|
||||
ap = ansi.ANSI_PARSER
|
||||
# ansi colors
|
||||
# show all ansi color-related codes
|
||||
|
|
|
|||
|
|
@ -18,17 +18,17 @@ line with a command (if there is no match to a known command,
|
|||
the line is just added to the editor buffer).
|
||||
"""
|
||||
|
||||
from src.comms.models import ChannelDB
|
||||
from src.utils import create
|
||||
from evennia.comms.models import ChannelDB
|
||||
from evennia.utils import create
|
||||
|
||||
# The command keys the engine is calling
|
||||
# (the actual names all start with __)
|
||||
from src.commands.cmdhandler import CMD_NOINPUT
|
||||
from src.commands.cmdhandler import CMD_NOMATCH
|
||||
from src.commands.cmdhandler import CMD_MULTIMATCH
|
||||
from src.commands.cmdhandler import CMD_CHANNEL
|
||||
from evennia.commands.cmdhandler import CMD_NOINPUT
|
||||
from evennia.commands.cmdhandler import CMD_NOMATCH
|
||||
from evennia.commands.cmdhandler import CMD_MULTIMATCH
|
||||
from evennia.commands.cmdhandler import CMD_CHANNEL
|
||||
|
||||
from src.commands.default.muxcommand import MuxCommand
|
||||
from evennia.commands.default.muxcommand import MuxCommand
|
||||
|
||||
# Command called when there is no input at line
|
||||
# (i.e. an lone return key)
|
||||
|
|
@ -76,7 +76,7 @@ class SystemMultimatch(MuxCommand):
|
|||
|
||||
matches = [(candidate, cmd) , (candidate, cmd), ...],
|
||||
|
||||
where candidate is an instance of src.commands.cmdparser.CommandCandidate
|
||||
where candidate is an instance of evennia.commands.cmdparser.CommandCandidate
|
||||
and cmd is an an instantiated Command object matching the candidate.
|
||||
"""
|
||||
key = CMD_MULTIMATCH
|
||||
|
|
@ -87,7 +87,7 @@ class SystemMultimatch(MuxCommand):
|
|||
Format multiple command matches to a useful error.
|
||||
|
||||
This is copied directly from the default method in
|
||||
src.commands.cmdhandler.
|
||||
evennia.commands.cmdhandler.
|
||||
|
||||
"""
|
||||
string = "There were multiple matches:"
|
||||
|
|
@ -170,4 +170,4 @@ class SystemSendToChannel(MuxCommand):
|
|||
return
|
||||
msg = "[%s] %s: %s" % (channel.key, caller.name, msg)
|
||||
msgobj = create.create_message(caller, msg, channels=[channel])
|
||||
channel.msg(msgobj)
|
||||
channel.msg(msgobj)
|
||||
|
|
|
|||
|
|
@ -13,15 +13,15 @@ import twisted
|
|||
from time import time as timemeasure
|
||||
|
||||
from django.conf import settings
|
||||
#from src.server.caches import get_cache_sizes
|
||||
from src.server.sessionhandler import SESSIONS
|
||||
from src.scripts.models import ScriptDB
|
||||
from src.objects.models import ObjectDB
|
||||
from src.players.models import PlayerDB
|
||||
from src.utils import logger, utils, gametime, create, is_pypy, prettytable
|
||||
from src.utils.evtable import EvTable
|
||||
from src.utils.utils import crop
|
||||
from src.commands.default.muxcommand import MuxCommand
|
||||
#from evennia.server.caches import get_cache_sizes
|
||||
from evennia.server.sessionhandler import SESSIONS
|
||||
from evennia.scripts.models import ScriptDB
|
||||
from evennia.objects.models import ObjectDB
|
||||
from evennia.players.models import PlayerDB
|
||||
from evennia.utils import logger, utils, gametime, create, is_pypy, prettytable
|
||||
from evennia.utils.evtable import EvTable
|
||||
from evennia.utils.utils import crop
|
||||
from evennia.commands.default.muxcommand import MuxCommand
|
||||
|
||||
# delayed imports
|
||||
_resource = None
|
||||
|
|
@ -665,7 +665,7 @@ class CmdServerLoad(MuxCommand):
|
|||
if not _resource:
|
||||
import resource as _resource
|
||||
if not _idmapper:
|
||||
from src.utils.idmapper import base as _idmapper
|
||||
from evennia.utils.idmapper import base as _idmapper
|
||||
|
||||
import resource
|
||||
loadavg = os.getloadavg()
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
This is part of the Evennia unittest framework, for testing the
|
||||
stability and integrity of the codebase during updates. This module
|
||||
test the default command set. It is instantiated by the
|
||||
src/objects/tests.py module, which in turn is run by as part of the
|
||||
evennia/objects/tests.py module, which in turn is run by as part of the
|
||||
main test suite started with
|
||||
> python game/manage.py test.
|
||||
|
||||
|
|
@ -15,14 +15,14 @@ main test suite started with
|
|||
import re
|
||||
from django.conf import settings
|
||||
from django.utils.unittest import TestCase
|
||||
from src.server.serversession import ServerSession
|
||||
from src.objects.objects import DefaultObject, DefaultCharacter
|
||||
from src.players.player import DefaultPlayer
|
||||
from src.utils import create, ansi
|
||||
from src.server.sessionhandler import SESSIONS
|
||||
from evennia.server.serversession import ServerSession
|
||||
from evennia.objects.objects import DefaultObject, DefaultCharacter
|
||||
from evennia.players.player import DefaultPlayer
|
||||
from evennia.utils import create, ansi
|
||||
from evennia.server.sessionhandler import SESSIONS
|
||||
|
||||
from django.db.models.signals import post_save
|
||||
from src.server.caches import field_post_save
|
||||
from evennia.server.caches import field_post_save
|
||||
post_save.connect(field_post_save, dispatch_uid="fieldcache")
|
||||
|
||||
# set up signal here since we are not starting the server
|
||||
|
|
@ -82,10 +82,10 @@ class CommandTest(TestCase):
|
|||
#print "creating player %i: %s" % (self.CID, self.__class__.__name__)
|
||||
self.player = create.create_player("TestPlayer%i" % self.CID, "test@test.com", "testpassword", typeclass=TestPlayerClass)
|
||||
self.player2 = create.create_player("TestPlayer%ib" % self.CID, "test@test.com", "testpassword", typeclass=TestPlayerClass)
|
||||
self.room1 = create.create_object("src.objects.objects.DefaultRoom", key="Room%i"%self.CID, nohome=True)
|
||||
self.room1 = create.create_object("evennia.objects.objects.DefaultRoom", key="Room%i"%self.CID, nohome=True)
|
||||
self.room1.db.desc = "room_desc"
|
||||
settings.DEFAULT_HOME = "#%i" % self.room1.id # we must have a default home
|
||||
self.room2 = create.create_object("src.objects.objects.DefaultRoom", key="Room%ib" % self.CID)
|
||||
self.room2 = create.create_object("evennia.objects.objects.DefaultRoom", key="Room%ib" % self.CID)
|
||||
self.obj1 = create.create_object(TestObjectClass, key="Obj%i" % self.CID, location=self.room1, home=self.room1)
|
||||
self.obj2 = create.create_object(TestObjectClass, key="Obj%ib" % self.CID, location=self.room1, home=self.room1)
|
||||
self.char1 = create.create_object(TestCharacterClass, key="Char%i" % self.CID, location=self.room1, home=self.room1)
|
||||
|
|
@ -93,7 +93,7 @@ class CommandTest(TestCase):
|
|||
self.char2 = create.create_object(TestCharacterClass, key="Char%ib" % self.CID, location=self.room1, home=self.room1)
|
||||
self.char1.player = self.player
|
||||
self.char2.player = self.player2
|
||||
self.script = create.create_script("src.scripts.scripts.Script", key="Script%i" % self.CID)
|
||||
self.script = create.create_script("evennia.scripts.scripts.Script", key="Script%i" % self.CID)
|
||||
self.player.permissions.add("Immortals")
|
||||
|
||||
# set up a fake session
|
||||
|
|
@ -151,7 +151,7 @@ class CommandTest(TestCase):
|
|||
# Individual module Tests
|
||||
#------------------------------------------------------------
|
||||
|
||||
from src.commands.default import general
|
||||
from evennia.commands.default import general
|
||||
class TestGeneral(CommandTest):
|
||||
CID = 1
|
||||
|
||||
|
|
@ -173,8 +173,8 @@ class TestGeneral(CommandTest):
|
|||
self.call(general.CmdAccess(), "", "Permission Hierarchy (climbing):")
|
||||
|
||||
|
||||
from src.commands.default import help
|
||||
from src.commands.default.cmdset_character import CharacterCmdSet
|
||||
from evennia.commands.default import help
|
||||
from evennia.commands.default.cmdset_character import CharacterCmdSet
|
||||
class TestHelp(CommandTest):
|
||||
CID = 2
|
||||
def test_cmds(self):
|
||||
|
|
@ -183,7 +183,7 @@ class TestHelp(CommandTest):
|
|||
self.call(help.CmdHelp(), "testhelp", "Help topic for testhelp", cmdset=CharacterCmdSet())
|
||||
|
||||
|
||||
from src.commands.default import system
|
||||
from evennia.commands.default import system
|
||||
class TestSystem(CommandTest):
|
||||
CID = 3
|
||||
def test_cmds(self):
|
||||
|
|
@ -196,7 +196,7 @@ class TestSystem(CommandTest):
|
|||
self.call(system.CmdServerLoad(), "", "Server CPU and Memory load:")
|
||||
|
||||
|
||||
from src.commands.default import admin
|
||||
from evennia.commands.default import admin
|
||||
class TestAdmin(CommandTest):
|
||||
CID = 4
|
||||
def test_cmds(self):
|
||||
|
|
@ -208,7 +208,7 @@ class TestAdmin(CommandTest):
|
|||
self.call(admin.CmdBan(), "Char4", "NameBan char4 was added.")
|
||||
|
||||
|
||||
from src.commands.default import player
|
||||
from evennia.commands.default import player
|
||||
class TestPlayer(CommandTest):
|
||||
CID = 5
|
||||
def test_cmds(self):
|
||||
|
|
@ -228,7 +228,7 @@ class TestPlayer(CommandTest):
|
|||
self.call(player.CmdQuell(), "", "Quelling to current puppet's permissions (immortals).", caller=self.player)
|
||||
|
||||
|
||||
from src.commands.default import building
|
||||
from evennia.commands.default import building
|
||||
class TestBuilding(CommandTest):
|
||||
CID = 6
|
||||
def test_cmds(self):
|
||||
|
|
@ -251,15 +251,15 @@ class TestBuilding(CommandTest):
|
|||
self.call(building.CmdUnLink(), "TestExit1", "Former exit TestExit1 no longer links anywhere.")
|
||||
self.call(building.CmdSetHome(), "Obj6 = Room6b", "Obj6's home location was changed from Room6")
|
||||
self.call(building.CmdListCmdSets(), "", "<DefaultCharacter (Union, prio 0, perm)>:")
|
||||
self.call(building.CmdTypeclass(), "Obj6 = src.objects.objects.DefaultExit",
|
||||
"Obj6 changed typeclass from src.commands.default.tests.TestObjectClass to src.objects.objects.DefaultExit")
|
||||
self.call(building.CmdTypeclass(), "Obj6 = evennia.objects.objects.DefaultExit",
|
||||
"Obj6 changed typeclass from evennia.commands.default.tests.TestObjectClass to evennia.objects.objects.DefaultExit")
|
||||
self.call(building.CmdLock(), "Obj6 = test:perm(Immortals)", "Added lock 'test:perm(Immortals)' to Obj6.")
|
||||
self.call(building.CmdFind(), "TestRoom1", "One Match")
|
||||
self.call(building.CmdScript(), "Obj6 = src.scripts.scripts.Script", "Script src.scripts.scripts.Script successfully added")
|
||||
self.call(building.CmdScript(), "Obj6 = evennia.scripts.scripts.Script", "Script evennia.scripts.scripts.Script successfully added")
|
||||
self.call(building.CmdTeleport(), "TestRoom1", "TestRoom1\nExits: back|Teleported to TestRoom1.")
|
||||
|
||||
|
||||
from src.commands.default import comms
|
||||
from evennia.commands.default import comms
|
||||
class TestComms(CommandTest):
|
||||
CID = 7
|
||||
def test_cmds(self):
|
||||
|
|
@ -278,7 +278,7 @@ class TestComms(CommandTest):
|
|||
self.call(comms.CmdCdestroy(), "testchan" ,"Channel 'testchan' was destroyed.")
|
||||
|
||||
|
||||
from src.commands.default import batchprocess
|
||||
from evennia.commands.default import batchprocess
|
||||
class TestBatchProcess(CommandTest):
|
||||
CID = 8
|
||||
def test_cmds(self):
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ import re
|
|||
from random import getrandbits
|
||||
import traceback
|
||||
from django.conf import settings
|
||||
from src.players.models import PlayerDB
|
||||
from src.objects.models import ObjectDB
|
||||
from src.server.models import ServerConfig
|
||||
from src.comms.models import ChannelDB
|
||||
from evennia.players.models import PlayerDB
|
||||
from evennia.objects.models import ObjectDB
|
||||
from evennia.server.models import ServerConfig
|
||||
from evennia.comms.models import ChannelDB
|
||||
|
||||
from src.utils import create, logger, utils, ansi
|
||||
from src.commands.default.muxcommand import MuxCommand
|
||||
from src.commands.cmdhandler import CMD_LOGINSTART
|
||||
from evennia.utils import create, logger, utils, ansi
|
||||
from evennia.commands.default.muxcommand import MuxCommand
|
||||
from evennia.commands.cmdhandler import CMD_LOGINSTART
|
||||
|
||||
# limit symbol import for API
|
||||
__all__ = ("CmdUnconnectedConnect", "CmdUnconnectedCreate",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue