Ran black on sources
This commit is contained in:
parent
24d52f229f
commit
f6b43b0416
125 changed files with 355 additions and 329 deletions
|
|
@ -1055,17 +1055,17 @@ MIDDLEWARE = [
|
||||||
# A list of Django apps (see INSTALLED_APPS) that will be listed first (if present)
|
# A list of Django apps (see INSTALLED_APPS) that will be listed first (if present)
|
||||||
# in the Django web Admin page.
|
# in the Django web Admin page.
|
||||||
DJANGO_ADMIN_APP_ORDER = [
|
DJANGO_ADMIN_APP_ORDER = [
|
||||||
"accounts",
|
"accounts",
|
||||||
"objects",
|
"objects",
|
||||||
"scripts",
|
"scripts",
|
||||||
"comms",
|
"comms",
|
||||||
"help",
|
"help",
|
||||||
"typeclasses",
|
"typeclasses",
|
||||||
"server",
|
"server",
|
||||||
"sites",
|
"sites",
|
||||||
"flatpages",
|
"flatpages",
|
||||||
"auth",
|
"auth",
|
||||||
]
|
]
|
||||||
|
|
||||||
# The following apps will be excluded from the Django web Admin page.
|
# The following apps will be excluded from the Django web Admin page.
|
||||||
DJANGO_ADMIN_APP_EXCLUDE = list()
|
DJANGO_ADMIN_APP_EXCLUDE = list()
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,12 @@ def _init(portal_mode=False):
|
||||||
from .comms.models import ChannelDB, Msg
|
from .comms.models import ChannelDB, Msg
|
||||||
from .locks import lockfuncs
|
from .locks import lockfuncs
|
||||||
from .objects.models import ObjectDB
|
from .objects.models import ObjectDB
|
||||||
from .objects.objects import DefaultCharacter, DefaultExit, DefaultObject, DefaultRoom
|
from .objects.objects import (
|
||||||
|
DefaultCharacter,
|
||||||
|
DefaultExit,
|
||||||
|
DefaultObject,
|
||||||
|
DefaultRoom,
|
||||||
|
)
|
||||||
from .prototypes.spawner import spawn
|
from .prototypes.spawner import spawn
|
||||||
from .scripts.models import ScriptDB
|
from .scripts.models import ScriptDB
|
||||||
from .scripts.monitorhandler import MONITOR_HANDLER
|
from .scripts.monitorhandler import MONITOR_HANDLER
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,14 @@ import re
|
||||||
import time
|
import time
|
||||||
from random import getrandbits
|
from random import getrandbits
|
||||||
|
|
||||||
import evennia
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth import authenticate, password_validation
|
from django.contrib.auth import authenticate, password_validation
|
||||||
from django.core.exceptions import ImproperlyConfigured, ValidationError
|
from django.core.exceptions import ImproperlyConfigured, ValidationError
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
import evennia
|
||||||
from evennia.accounts.manager import AccountManager
|
from evennia.accounts.manager import AccountManager
|
||||||
from evennia.accounts.models import AccountDB
|
from evennia.accounts.models import AccountDB
|
||||||
from evennia.commands.cmdsethandler import CmdSetHandler
|
from evennia.commands.cmdsethandler import CmdSetHandler
|
||||||
|
|
@ -38,7 +39,13 @@ from evennia.typeclasses.attributes import ModelAttributeBackend, NickHandler
|
||||||
from evennia.typeclasses.models import TypeclassBase
|
from evennia.typeclasses.models import TypeclassBase
|
||||||
from evennia.utils import class_from_module, create, logger
|
from evennia.utils import class_from_module, create, logger
|
||||||
from evennia.utils.optionhandler import OptionHandler
|
from evennia.utils.optionhandler import OptionHandler
|
||||||
from evennia.utils.utils import is_iter, lazy_property, make_iter, to_str, variable_from_module
|
from evennia.utils.utils import (
|
||||||
|
is_iter,
|
||||||
|
lazy_property,
|
||||||
|
make_iter,
|
||||||
|
to_str,
|
||||||
|
variable_from_module,
|
||||||
|
)
|
||||||
|
|
||||||
__all__ = ("DefaultAccount", "DefaultGuest")
|
__all__ = ("DefaultAccount", "DefaultGuest")
|
||||||
|
|
||||||
|
|
@ -1565,9 +1572,7 @@ class DefaultAccount(AccountDB, metaclass=TypeclassBase):
|
||||||
else:
|
else:
|
||||||
# In this mode we don't auto-connect but by default end up at a character selection
|
# In this mode we don't auto-connect but by default end up at a character selection
|
||||||
# screen. We execute look on the account.
|
# screen. We execute look on the account.
|
||||||
self.msg(
|
self.msg(self.at_look(target=self.characters, session=session), session=session)
|
||||||
self.at_look(target=self.characters, session=session), session=session
|
|
||||||
)
|
|
||||||
|
|
||||||
def at_failed_login(self, session, **kwargs):
|
def at_failed_login(self, session, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -410,7 +410,9 @@ class RSSBot(Bot):
|
||||||
# instruct the server and portal to create a new session with
|
# instruct the server and portal to create a new session with
|
||||||
# the stored configuration
|
# the stored configuration
|
||||||
configdict = {"uid": self.dbid, "url": self.db.rss_url, "rate": self.db.rss_rate}
|
configdict = {"uid": self.dbid, "url": self.db.rss_url, "rate": self.db.rss_rate}
|
||||||
evennia.SESSION_HANDLER.start_bot_session("evennia.server.portal.rss.RSSBotFactory", configdict)
|
evennia.SESSION_HANDLER.start_bot_session(
|
||||||
|
"evennia.server.portal.rss.RSSBotFactory", configdict
|
||||||
|
)
|
||||||
|
|
||||||
def execute_cmd(self, txt=None, session=None, **kwargs):
|
def execute_cmd(self, txt=None, session=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
@ -658,7 +660,7 @@ class DiscordBot(Bot):
|
||||||
guild_id (int) - The guild the role will be assigned in.
|
guild_id (int) - The guild the role will be assigned in.
|
||||||
user_id (int) - The user the given role will be assigned to.
|
user_id (int) - The user the given role will be assigned to.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
super().msg(role=(role_id, guild_id, user_id))
|
super().msg(role=(role_id, guild_id, user_id))
|
||||||
|
|
||||||
def direct_msg(self, message, sender, **kwargs):
|
def direct_msg(self, message, sender, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -357,9 +357,7 @@ class TestAccountPuppetDeletion(BaseEvenniaTest):
|
||||||
@override_settings(MULTISESSION_MODE=2)
|
@override_settings(MULTISESSION_MODE=2)
|
||||||
def test_puppet_deletion(self):
|
def test_puppet_deletion(self):
|
||||||
# Check for existing chars
|
# Check for existing chars
|
||||||
self.assertFalse(
|
self.assertFalse(self.account.characters, "Account should not have any chars by default.")
|
||||||
self.account.characters, "Account should not have any chars by default."
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add char1 to account's playable characters
|
# Add char1 to account's playable characters
|
||||||
self.account.characters.add(self.char1)
|
self.account.characters.add(self.char1)
|
||||||
|
|
@ -410,9 +408,7 @@ class TestDefaultAccountEv(BaseEvenniaTest):
|
||||||
self.assertEqual(idle, 10)
|
self.assertEqual(idle, 10)
|
||||||
|
|
||||||
# test no sessions
|
# test no sessions
|
||||||
with patch(
|
with patch("evennia.SESSION_HANDLER.sessions_from_account", return_value=[]) as mock_sessh:
|
||||||
"evennia.SESSION_HANDLER.sessions_from_account", return_value=[]
|
|
||||||
) as mock_sessh:
|
|
||||||
idle = self.account.idle_time
|
idle = self.account.idle_time
|
||||||
self.assertEqual(idle, None)
|
self.assertEqual(idle, None)
|
||||||
|
|
||||||
|
|
@ -423,9 +419,7 @@ class TestDefaultAccountEv(BaseEvenniaTest):
|
||||||
self.assertEqual(conn, 10)
|
self.assertEqual(conn, 10)
|
||||||
|
|
||||||
# test no sessions
|
# test no sessions
|
||||||
with patch(
|
with patch("evennia.SESSION_HANDLER.sessions_from_account", return_value=[]) as mock_sessh:
|
||||||
"evennia.SESSION_HANDLER.sessions_from_account", return_value=[]
|
|
||||||
) as mock_sessh:
|
|
||||||
idle = self.account.connection_time
|
idle = self.account.connection_time
|
||||||
self.assertEqual(idle, None)
|
self.assertEqual(idle, None)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,14 @@ from weakref import WeakValueDictionary
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from evennia.commands.command import InterruptCommand
|
|
||||||
from evennia.utils import logger, utils
|
|
||||||
from evennia.utils.utils import string_suggestions
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
from twisted.internet.defer import inlineCallbacks, returnValue
|
from twisted.internet.defer import inlineCallbacks, returnValue
|
||||||
from twisted.internet.task import deferLater
|
from twisted.internet.task import deferLater
|
||||||
|
|
||||||
|
from evennia.commands.command import InterruptCommand
|
||||||
|
from evennia.utils import logger, utils
|
||||||
|
from evennia.utils.utils import string_suggestions
|
||||||
|
|
||||||
_IN_GAME_ERRORS = settings.IN_GAME_ERRORS
|
_IN_GAME_ERRORS = settings.IN_GAME_ERRORS
|
||||||
|
|
||||||
__all__ = ("cmdhandler", "InterruptCommand")
|
__all__ = ("cmdhandler", "InterruptCommand")
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ from traceback import format_exc
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from evennia.commands.cmdset import CmdSet
|
from evennia.commands.cmdset import CmdSet
|
||||||
from evennia.server.models import ServerConfig
|
from evennia.server.models import ServerConfig
|
||||||
from evennia.utils import logger, utils
|
from evennia.utils import logger, utils
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import re
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
|
|
||||||
from evennia.locks.lockhandler import LockHandler
|
from evennia.locks.lockhandler import LockHandler
|
||||||
from evennia.utils.ansi import ANSIString
|
from evennia.utils.ansi import ANSIString
|
||||||
from evennia.utils.evtable import EvTable
|
from evennia.utils.evtable import EvTable
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import time
|
||||||
from codecs import lookup as codecs_lookup
|
from codecs import lookup as codecs_lookup
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
import evennia
|
import evennia
|
||||||
from evennia.utils import create, logger, search, utils
|
from evennia.utils import create, logger, search, utils
|
||||||
|
|
||||||
|
|
@ -74,6 +75,7 @@ class MuxAccountLookCommand(COMMAND_DEFAULT_CLASS):
|
||||||
# use self.account instead of self.caller, just to be sure. Also self.msg()
|
# use self.account instead of self.caller, just to be sure. Also self.msg()
|
||||||
# is used to make sure returns go to the right session
|
# is used to make sure returns go to the right session
|
||||||
|
|
||||||
|
|
||||||
# note that this is inheriting from MuxAccountLookCommand,
|
# note that this is inheriting from MuxAccountLookCommand,
|
||||||
# and has the .playable property.
|
# and has the .playable property.
|
||||||
class CmdOOCLook(MuxAccountLookCommand):
|
class CmdOOCLook(MuxAccountLookCommand):
|
||||||
|
|
@ -307,7 +309,7 @@ class CmdIC(COMMAND_DEFAULT_CLASS):
|
||||||
else:
|
else:
|
||||||
# argument given
|
# argument given
|
||||||
|
|
||||||
if (playables := account.characters):
|
if playables := account.characters:
|
||||||
# look at the playable_characters list first
|
# look at the playable_characters list first
|
||||||
character_candidates.extend(
|
character_candidates.extend(
|
||||||
utils.make_iter(
|
utils.make_iter(
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,8 @@ import time
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from evennia.server.models import ServerConfig
|
|
||||||
|
|
||||||
import evennia
|
import evennia
|
||||||
|
from evennia.server.models import ServerConfig
|
||||||
from evennia.utils import class_from_module, evtable, logger, search
|
from evennia.utils import class_from_module, evtable, logger, search
|
||||||
|
|
||||||
COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS)
|
COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS)
|
||||||
|
|
@ -512,7 +511,6 @@ class CmdPerm(COMMAND_DEFAULT_CLASS):
|
||||||
permissions = obj.permissions.all()
|
permissions = obj.permissions.all()
|
||||||
|
|
||||||
for perm in self.rhslist:
|
for perm in self.rhslist:
|
||||||
|
|
||||||
# don't allow to set a permission higher in the hierarchy than
|
# don't allow to set a permission higher in the hierarchy than
|
||||||
# the one the caller has (to prevent self-escalation)
|
# the one the caller has (to prevent self-escalation)
|
||||||
if perm.lower() in PERMISSION_HIERARCHY and not obj.locks.check_lockstring(
|
if perm.lower() in PERMISSION_HIERARCHY and not obj.locks.check_lockstring(
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import re
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
from django.db.models import Max, Min, Q
|
from django.db.models import Max, Min, Q
|
||||||
|
|
||||||
from evennia import InterruptCommand
|
from evennia import InterruptCommand
|
||||||
from evennia.commands.cmdhandler import get_and_merge_cmdsets
|
from evennia.commands.cmdhandler import get_and_merge_cmdsets
|
||||||
from evennia.locks.lockhandler import LockException
|
from evennia.locks.lockhandler import LockException
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ Communication commands:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from evennia.accounts import bots
|
from evennia.accounts import bots
|
||||||
from evennia.accounts.models import AccountDB
|
from evennia.accounts.models import AccountDB
|
||||||
from evennia.comms.comms import DefaultChannel
|
from evennia.comms.comms import DefaultChannel
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,6 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
|
||||||
)
|
)
|
||||||
|
|
||||||
if "list" in switches or self.cmdstring in ("nicks",):
|
if "list" in switches or self.cmdstring in ("nicks",):
|
||||||
|
|
||||||
if not nicklist:
|
if not nicklist:
|
||||||
string = "|wNo nicks defined.|n"
|
string = "|wNo nicks defined.|n"
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,20 @@ from dataclasses import dataclass
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from evennia.help.filehelp import FILE_HELP_ENTRIES
|
from evennia.help.filehelp import FILE_HELP_ENTRIES
|
||||||
from evennia.help.models import HelpEntry
|
from evennia.help.models import HelpEntry
|
||||||
from evennia.help.utils import help_search_with_index, parse_entry_for_subcategories
|
from evennia.help.utils import help_search_with_index, parse_entry_for_subcategories
|
||||||
from evennia.utils import create, evmore
|
from evennia.utils import create, evmore
|
||||||
from evennia.utils.ansi import ANSIString
|
from evennia.utils.ansi import ANSIString
|
||||||
from evennia.utils.eveditor import EvEditor
|
from evennia.utils.eveditor import EvEditor
|
||||||
from evennia.utils.utils import class_from_module, dedent, format_grid, inherits_from, pad
|
from evennia.utils.utils import (
|
||||||
|
class_from_module,
|
||||||
|
dedent,
|
||||||
|
format_grid,
|
||||||
|
inherits_from,
|
||||||
|
pad,
|
||||||
|
)
|
||||||
|
|
||||||
CMD_IGNORE_PREFIXES = settings.CMD_IGNORE_PREFIXES
|
CMD_IGNORE_PREFIXES = settings.CMD_IGNORE_PREFIXES
|
||||||
COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS)
|
COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS)
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,10 @@ import time
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import django
|
import django
|
||||||
import evennia
|
|
||||||
import twisted
|
import twisted
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
import evennia
|
||||||
from evennia.accounts.models import AccountDB
|
from evennia.accounts.models import AccountDB
|
||||||
from evennia.scripts.taskhandler import TaskHandlerTask
|
from evennia.scripts.taskhandler import TaskHandlerTask
|
||||||
from evennia.utils import gametime, logger, search, utils
|
from evennia.utils import gametime, logger, search, utils
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,9 @@ from unittest.mock import MagicMock, Mock, patch
|
||||||
from anything import Anything
|
from anything import Anything
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
|
from parameterized import parameterized
|
||||||
|
from twisted.internet import task
|
||||||
|
|
||||||
import evennia
|
import evennia
|
||||||
from evennia import (
|
from evennia import (
|
||||||
DefaultCharacter,
|
DefaultCharacter,
|
||||||
|
|
@ -29,7 +32,14 @@ from evennia import (
|
||||||
from evennia.commands import cmdparser
|
from evennia.commands import cmdparser
|
||||||
from evennia.commands.cmdset import CmdSet
|
from evennia.commands.cmdset import CmdSet
|
||||||
from evennia.commands.command import Command, InterruptCommand
|
from evennia.commands.command import Command, InterruptCommand
|
||||||
from evennia.commands.default import account, admin, batchprocess, building, comms, general
|
from evennia.commands.default import (
|
||||||
|
account,
|
||||||
|
admin,
|
||||||
|
batchprocess,
|
||||||
|
building,
|
||||||
|
comms,
|
||||||
|
general,
|
||||||
|
)
|
||||||
from evennia.commands.default import help as help_module
|
from evennia.commands.default import help as help_module
|
||||||
from evennia.commands.default import syscommands, system, unloggedin
|
from evennia.commands.default import syscommands, system, unloggedin
|
||||||
from evennia.commands.default.cmdset_character import CharacterCmdSet
|
from evennia.commands.default.cmdset_character import CharacterCmdSet
|
||||||
|
|
@ -38,8 +48,6 @@ from evennia.prototypes import prototypes as protlib
|
||||||
from evennia.utils import create, gametime, utils
|
from evennia.utils import create, gametime, utils
|
||||||
from evennia.utils.test_resources import BaseEvenniaCommandTest # noqa
|
from evennia.utils.test_resources import BaseEvenniaCommandTest # noqa
|
||||||
from evennia.utils.test_resources import BaseEvenniaTest, EvenniaCommandTest
|
from evennia.utils.test_resources import BaseEvenniaTest, EvenniaCommandTest
|
||||||
from parameterized import parameterized
|
|
||||||
from twisted.internet import task
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Command testing
|
# Command testing
|
||||||
|
|
@ -1597,8 +1605,9 @@ class TestBuilding(BaseEvenniaCommandTest):
|
||||||
self.call(
|
self.call(
|
||||||
building.CmdTeleport(),
|
building.CmdTeleport(),
|
||||||
"Obj = Room2",
|
"Obj = Room2",
|
||||||
"Obj(#{}) is leaving Room(#{}), heading for Room2(#{}).|Teleported Obj -> Room2."
|
"Obj(#{}) is leaving Room(#{}), heading for Room2(#{}).|Teleported Obj -> Room2.".format(
|
||||||
.format(oid, rid, rid2),
|
oid, rid, rid2
|
||||||
|
),
|
||||||
)
|
)
|
||||||
self.call(building.CmdTeleport(), "NotFound = Room", "Could not find 'NotFound'.")
|
self.call(building.CmdTeleport(), "NotFound = Room", "Could not find 'NotFound'.")
|
||||||
self.call(
|
self.call(
|
||||||
|
|
@ -1714,8 +1723,7 @@ class TestBuilding(BaseEvenniaCommandTest):
|
||||||
self.call(
|
self.call(
|
||||||
building.CmdSpawn(),
|
building.CmdSpawn(),
|
||||||
"{'prototype_key':'GOBLIN', 'typeclass':'evennia.objects.objects.DefaultCharacter', "
|
"{'prototype_key':'GOBLIN', 'typeclass':'evennia.objects.objects.DefaultCharacter', "
|
||||||
"'key':'goblin', 'location':'%s'}"
|
"'key':'goblin', 'location':'%s'}" % spawnLoc.dbref,
|
||||||
% spawnLoc.dbref,
|
|
||||||
"Spawned goblin",
|
"Spawned goblin",
|
||||||
)
|
)
|
||||||
goblin = get_object(self, "goblin")
|
goblin = get_object(self, "goblin")
|
||||||
|
|
@ -1763,8 +1771,7 @@ class TestBuilding(BaseEvenniaCommandTest):
|
||||||
self.call(
|
self.call(
|
||||||
building.CmdSpawn(),
|
building.CmdSpawn(),
|
||||||
"/noloc {'prototype_parent':'TESTBALL', 'key': 'Ball', 'prototype_key': 'foo',"
|
"/noloc {'prototype_parent':'TESTBALL', 'key': 'Ball', 'prototype_key': 'foo',"
|
||||||
" 'location':'%s'}"
|
" 'location':'%s'}" % spawnLoc.dbref,
|
||||||
% spawnLoc.dbref,
|
|
||||||
"Spawned Ball",
|
"Spawned Ball",
|
||||||
)
|
)
|
||||||
ball = get_object(self, "Ball")
|
ball = get_object(self, "Ball")
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,9 @@ import datetime
|
||||||
import re
|
import re
|
||||||
from codecs import lookup as codecs_lookup
|
from codecs import lookup as codecs_lookup
|
||||||
|
|
||||||
import evennia
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
import evennia
|
||||||
from evennia.commands.cmdhandler import CMD_LOGINSTART
|
from evennia.commands.cmdhandler import CMD_LOGINSTART
|
||||||
from evennia.comms.models import ChannelDB
|
from evennia.comms.models import ChannelDB
|
||||||
from evennia.utils import class_from_module, create, gametime, logger, utils
|
from evennia.utils import class_from_module, create, gametime, logger, utils
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ Unit testing for the Command system itself.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
|
|
||||||
from evennia.commands import cmdparser
|
from evennia.commands import cmdparser
|
||||||
from evennia.commands.cmdset import CmdSet
|
from evennia.commands.cmdset import CmdSet
|
||||||
from evennia.commands.command import Command
|
from evennia.commands.command import Command
|
||||||
|
|
@ -990,9 +991,10 @@ class TestOptionTransferReplace(TestCase):
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from evennia.commands import cmdhandler
|
|
||||||
from twisted.trial.unittest import TestCase as TwistedTestCase
|
from twisted.trial.unittest import TestCase as TwistedTestCase
|
||||||
|
|
||||||
|
from evennia.commands import cmdhandler
|
||||||
|
|
||||||
|
|
||||||
def _mockdelay(time, func, *args, **kwargs):
|
def _mockdelay(time, func, *args, **kwargs):
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
|
|
@ -1250,7 +1252,6 @@ class TestIssue3090(BaseEvenniaTest):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def test_long_aliases(self):
|
def test_long_aliases(self):
|
||||||
|
|
||||||
cmdset_g = _CmdSetG()
|
cmdset_g = _CmdSetG()
|
||||||
|
|
||||||
# print(cmdset_g.commands[0]._keyaliases)
|
# print(cmdset_g.commands[0]._keyaliases)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import re
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
|
|
||||||
from evennia.comms.managers import ChannelManager
|
from evennia.comms.managers import ChannelManager
|
||||||
from evennia.comms.models import ChannelDB
|
from evennia.comms.models import ChannelDB
|
||||||
from evennia.typeclasses.models import TypeclassBase
|
from evennia.typeclasses.models import TypeclassBase
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ Comm system components.
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from evennia.server import signals
|
from evennia.server import signals
|
||||||
from evennia.typeclasses.managers import TypeclassManager, TypedObjectManager
|
from evennia.typeclasses.managers import TypeclassManager, TypedObjectManager
|
||||||
from evennia.utils import logger
|
from evennia.utils import logger
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ necessary to easily be able to delete connections on the fly).
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from evennia.comms import managers
|
from evennia.comms import managers
|
||||||
from evennia.locks.lockhandler import LockHandler
|
from evennia.locks.lockhandler import LockHandler
|
||||||
from evennia.typeclasses.models import TypedObject
|
from evennia.typeclasses.models import TypedObject
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@ from inspect import getfullargspec
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from evennia import CmdSet, Command
|
from evennia import CmdSet, Command
|
||||||
from evennia.commands import cmdhandler
|
from evennia.commands import cmdhandler
|
||||||
from evennia.utils.ansi import strip_ansi
|
from evennia.utils.ansi import strip_ansi
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ class TestBuildingMenu(BaseEvenniaCommandTest):
|
||||||
|
|
||||||
def test_multi_level(self):
|
def test_multi_level(self):
|
||||||
"""Test multi-level choices."""
|
"""Test multi-level choices."""
|
||||||
|
|
||||||
# Creaste three succeeding menu (t2 is contained in t1, t3 is contained in t2)
|
# Creaste three succeeding menu (t2 is contained in t1, t3 is contained in t2)
|
||||||
def on_nomatch_t1(caller, menu):
|
def on_nomatch_t1(caller, menu):
|
||||||
menu.move("whatever") # this will be valid since after t1 is a joker
|
menu.move("whatever") # this will be valid since after t1 is a joker
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class TestComponents(EvenniaTest):
|
||||||
InheritedTCWithComponents, key="char_with_c", location=self.room1, home=self.room1
|
InheritedTCWithComponents, key="char_with_c", location=self.room1, home=self.room1
|
||||||
)
|
)
|
||||||
assert self.char1.test_a
|
assert self.char1.test_a
|
||||||
assert not self.char1.cmp.get('test_c')
|
assert not self.char1.cmp.get("test_c")
|
||||||
assert char_with_c.test_c
|
assert char_with_c.test_c
|
||||||
|
|
||||||
def test_character_instances_components_properly(self):
|
def test_character_instances_components_properly(self):
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ def start_plugin_services(portal):
|
||||||
factory.noisy = False
|
factory.noisy = False
|
||||||
factory.protocol = GodotWebSocketClient
|
factory.protocol = GodotWebSocketClient
|
||||||
from evennia.server.portal.portalsessionhandler import PORTAL_SESSIONS
|
from evennia.server.portal.portalsessionhandler import PORTAL_SESSIONS
|
||||||
|
|
||||||
factory.sessionhandler = PORTAL_SESSIONS
|
factory.sessionhandler = PORTAL_SESSIONS
|
||||||
|
|
||||||
interface = "127.0.0.1" if LOCKDOWN_MODE else settings.GODOT_CLIENT_WEBSOCKET_CLIENT_INTERFACE
|
interface = "127.0.0.1" if LOCKDOWN_MODE else settings.GODOT_CLIENT_WEBSOCKET_CLIENT_INTERFACE
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,6 @@ def node_enter_password(caller, raw_string, **kwargs):
|
||||||
|
|
||||||
username = kwargs["username"]
|
username = kwargs["username"]
|
||||||
if kwargs["new_user"]:
|
if kwargs["new_user"]:
|
||||||
|
|
||||||
if kwargs.get("retry_password"):
|
if kwargs.get("retry_password"):
|
||||||
# Attempting to fix password
|
# Attempting to fix password
|
||||||
text = "Enter a new password:"
|
text = "Enter a new password:"
|
||||||
|
|
|
||||||
|
|
@ -296,7 +296,6 @@ class CmdWho(CmdEvscapeRoom, default_cmds.CmdWho):
|
||||||
obj2_search = False
|
obj2_search = False
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
|
|
||||||
caller = self.caller
|
caller = self.caller
|
||||||
|
|
||||||
if self.args == "all":
|
if self.args == "all":
|
||||||
|
|
@ -344,7 +343,6 @@ class CmdSpeak(Command):
|
||||||
arg_regex = r"\w|\s|$"
|
arg_regex = r"\w|\s|$"
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
|
|
||||||
args = self.args.strip()
|
args = self.args.strip()
|
||||||
caller = self.caller
|
caller = self.caller
|
||||||
action = self.cmdname
|
action = self.cmdname
|
||||||
|
|
@ -584,7 +582,6 @@ class CmdFocusInteraction(CmdEvscapeRoom):
|
||||||
self.room = self.caller.location
|
self.room = self.caller.location
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
|
|
||||||
focused = self.focus
|
focused = self.focus
|
||||||
action = self.action
|
action = self.action
|
||||||
|
|
||||||
|
|
@ -604,7 +601,6 @@ class CmdStand(CmdEvscapeRoom):
|
||||||
key = "stand"
|
key = "stand"
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
|
|
||||||
# Positionable objects will set this flag on you.
|
# Positionable objects will set this flag on you.
|
||||||
pos = self.caller.attributes.get("position", category=self.room.tagcategory)
|
pos = self.caller.attributes.get("position", category=self.room.tagcategory)
|
||||||
|
|
||||||
|
|
@ -710,7 +706,6 @@ class CmdSetFlag(CmdEvscapeRoom):
|
||||||
obj2_search = False
|
obj2_search = False
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
|
|
||||||
if not self.arg2:
|
if not self.arg2:
|
||||||
self.caller.msg("Usage: flag <obj> with <flagname>")
|
self.caller.msg("Usage: flag <obj> with <flagname>")
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ def _move_to_room(caller, raw_string, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def _create_new_room(caller, raw_string, **kwargs):
|
def _create_new_room(caller, raw_string, **kwargs):
|
||||||
|
|
||||||
# create a random name, retrying until we find
|
# create a random name, retrying until we find
|
||||||
# a unique one
|
# a unique one
|
||||||
key = create_fantasy_word(length=5, capitalize=True)
|
key = create_fantasy_word(length=5, capitalize=True)
|
||||||
|
|
@ -147,7 +146,6 @@ def node_start(caller, raw_string, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def node_set_desc(caller, raw_string, **kwargs):
|
def node_set_desc(caller, raw_string, **kwargs):
|
||||||
|
|
||||||
current_desc = kwargs.get("desc", caller.db.desc)
|
current_desc = kwargs.get("desc", caller.db.desc)
|
||||||
|
|
||||||
text = (
|
text = (
|
||||||
|
|
@ -176,7 +174,6 @@ def node_set_desc(caller, raw_string, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def node_create_room(caller, raw_string, **kwargs):
|
def node_create_room(caller, raw_string, **kwargs):
|
||||||
|
|
||||||
text = _CREATE_ROOM_TEXT
|
text = _CREATE_ROOM_TEXT
|
||||||
|
|
||||||
options = (
|
options = (
|
||||||
|
|
@ -188,7 +185,6 @@ def node_create_room(caller, raw_string, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def node_join_room(caller, raw_string, **kwargs):
|
def node_join_room(caller, raw_string, **kwargs):
|
||||||
|
|
||||||
room = kwargs["room"]
|
room = kwargs["room"]
|
||||||
stats = room.db.stats or {"progress": 0}
|
stats = room.db.stats or {"progress": 0}
|
||||||
|
|
||||||
|
|
@ -282,7 +278,6 @@ def _set_thing_style(caller, raw_string, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def _toggle_screen_reader(caller, raw_string, **kwargs):
|
def _toggle_screen_reader(caller, raw_string, **kwargs):
|
||||||
|
|
||||||
session = kwargs["session"]
|
session = kwargs["session"]
|
||||||
# flip old setting
|
# flip old setting
|
||||||
session.protocol_flags["SCREENREADER"] = not session.protocol_flags.get("SCREENREADER", False)
|
session.protocol_flags["SCREENREADER"] = not session.protocol_flags.get("SCREENREADER", False)
|
||||||
|
|
|
||||||
|
|
@ -416,7 +416,6 @@ class Rotatable(EvscaperoomObject):
|
||||||
self.set_flag("rotatable")
|
self.set_flag("rotatable")
|
||||||
|
|
||||||
def at_focus_rotate(self, caller, **kwargs):
|
def at_focus_rotate(self, caller, **kwargs):
|
||||||
|
|
||||||
if self.check_flag("rotatable"):
|
if self.check_flag("rotatable"):
|
||||||
self.at_rotate(caller)
|
self.at_rotate(caller)
|
||||||
else:
|
else:
|
||||||
|
|
@ -501,7 +500,6 @@ class Readable(EvscaperoomObject):
|
||||||
self.set_flag(self.read_flag)
|
self.set_flag(self.read_flag)
|
||||||
|
|
||||||
def at_focus_read(self, caller, **kwargs):
|
def at_focus_read(self, caller, **kwargs):
|
||||||
|
|
||||||
if self.read_flag is None or self.check_flag(self.read_flag):
|
if self.read_flag is None or self.check_flag(self.read_flag):
|
||||||
self.at_read(caller)
|
self.at_read(caller)
|
||||||
else:
|
else:
|
||||||
|
|
@ -525,7 +523,6 @@ class IndexReadable(Readable):
|
||||||
index = {"page1": "This is page1", "page2": "This is page2", "page two": "page2"} # alias
|
index = {"page1": "This is page1", "page2": "This is page2", "page two": "page2"} # alias
|
||||||
|
|
||||||
def at_focus_read(self, caller, **kwargs):
|
def at_focus_read(self, caller, **kwargs):
|
||||||
|
|
||||||
topic = kwargs.get("args").strip().lower()
|
topic = kwargs.get("args").strip().lower()
|
||||||
|
|
||||||
entry = self.index.get(topic, None)
|
entry = self.index.get(topic, None)
|
||||||
|
|
@ -931,7 +928,6 @@ class CodeInput(EvscaperoomObject):
|
||||||
infinitely_locked = False
|
infinitely_locked = False
|
||||||
|
|
||||||
def at_focus_code(self, caller, **kwargs):
|
def at_focus_code(self, caller, **kwargs):
|
||||||
|
|
||||||
args = self.parse(kwargs["args"].strip())
|
args = self.parse(kwargs["args"].strip())
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ from .room import EvscapeRoom
|
||||||
|
|
||||||
class CleanupScript(DefaultScript):
|
class CleanupScript(DefaultScript):
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
|
|
||||||
self.key = "evscaperoom_cleanup"
|
self.key = "evscaperoom_cleanup"
|
||||||
self.desc = "Cleans up empty evscaperooms"
|
self.desc = "Cleans up empty evscaperooms"
|
||||||
|
|
||||||
|
|
@ -23,7 +22,6 @@ class CleanupScript(DefaultScript):
|
||||||
self.persistent = True
|
self.persistent = True
|
||||||
|
|
||||||
def at_repeat(self):
|
def at_repeat(self):
|
||||||
|
|
||||||
for room in EvscapeRoom.objects.all():
|
for room in EvscapeRoom.objects.all():
|
||||||
if not room.get_all_characters():
|
if not room.get_all_characters():
|
||||||
# this room is empty
|
# this room is empty
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ class TestEvscaperoomCommands(BaseEvenniaCommandTest):
|
||||||
self.obj1.location = self.room1
|
self.obj1.location = self.room1
|
||||||
|
|
||||||
def test_base_search(self):
|
def test_base_search(self):
|
||||||
|
|
||||||
cmd = commands.CmdEvscapeRoom()
|
cmd = commands.CmdEvscapeRoom()
|
||||||
cmd.caller = self.char1
|
cmd.caller = self.char1
|
||||||
|
|
||||||
|
|
@ -35,7 +34,6 @@ class TestEvscaperoomCommands(BaseEvenniaCommandTest):
|
||||||
self.assertRaises(InterruptCommand, cmd._search, "Foo", True)
|
self.assertRaises(InterruptCommand, cmd._search, "Foo", True)
|
||||||
|
|
||||||
def test_base_parse(self):
|
def test_base_parse(self):
|
||||||
|
|
||||||
cmd = commands.CmdEvscapeRoom()
|
cmd = commands.CmdEvscapeRoom()
|
||||||
cmd.caller = self.char1
|
cmd.caller = self.char1
|
||||||
|
|
||||||
|
|
@ -211,7 +209,6 @@ class TestUtils(BaseEvenniaTest):
|
||||||
self.assertTrue(bool(obj2.pk))
|
self.assertTrue(bool(obj2.pk))
|
||||||
|
|
||||||
def test_parse_for_perspectives(self):
|
def test_parse_for_perspectives(self):
|
||||||
|
|
||||||
second, third = utils.parse_for_perspectives("~You ~look at the nice book", "TestGuy")
|
second, third = utils.parse_for_perspectives("~You ~look at the nice book", "TestGuy")
|
||||||
self.assertTrue(second, "You look at the nice book")
|
self.assertTrue(second, "You look at the nice book")
|
||||||
self.assertTrue(third, "TestGuy looks at the nice book")
|
self.assertTrue(third, "TestGuy looks at the nice book")
|
||||||
|
|
@ -221,7 +218,6 @@ class TestUtils(BaseEvenniaTest):
|
||||||
self.assertTrue(third, "With a smile, TestGuy was gone")
|
self.assertTrue(third, "With a smile, TestGuy was gone")
|
||||||
|
|
||||||
def test_parse_for_things(self):
|
def test_parse_for_things(self):
|
||||||
|
|
||||||
string = "Looking at *book and *key."
|
string = "Looking at *book and *key."
|
||||||
self.assertEqual(utils.parse_for_things(string, 0), "Looking at book and key.")
|
self.assertEqual(utils.parse_for_things(string, 0), "Looking at book and key.")
|
||||||
self.assertEqual(utils.parse_for_things(string, 1), "Looking at |ybook|n and |ykey|n.")
|
self.assertEqual(utils.parse_for_things(string, 1), "Looking at |ybook|n and |ykey|n.")
|
||||||
|
|
@ -240,7 +236,6 @@ class TestEvScapeRoom(BaseEvenniaTest):
|
||||||
self.room.delete()
|
self.room.delete()
|
||||||
|
|
||||||
def test_room_methods(self):
|
def test_room_methods(self):
|
||||||
|
|
||||||
room = self.room
|
room = self.room
|
||||||
self.char1.location = room
|
self.char1.location = room
|
||||||
|
|
||||||
|
|
@ -279,7 +274,6 @@ class TestStates(BaseEvenniaTest):
|
||||||
return states
|
return states
|
||||||
|
|
||||||
def test_base_state(self):
|
def test_base_state(self):
|
||||||
|
|
||||||
st = basestate.BaseState(self.room.statehandler, self.room)
|
st = basestate.BaseState(self.room.statehandler, self.room)
|
||||||
st.init()
|
st.init()
|
||||||
obj = st.create_object(objects.Edible, key="apple")
|
obj = st.create_object(objects.Edible, key="apple")
|
||||||
|
|
@ -291,7 +285,6 @@ class TestStates(BaseEvenniaTest):
|
||||||
"Tick through all defined states"
|
"Tick through all defined states"
|
||||||
|
|
||||||
for mod in self._get_all_state_modules():
|
for mod in self._get_all_state_modules():
|
||||||
|
|
||||||
state = mod.State(self.room.statehandler, self.room)
|
state = mod.State(self.room.statehandler, self.room)
|
||||||
state.init()
|
state.init()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ or implement the same locks/hooks in your own typeclasses.
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from evennia import AttributeProperty, CmdSet, DefaultObject
|
from evennia import AttributeProperty, CmdSet, DefaultObject
|
||||||
from evennia.commands.default.general import CmdLook, CmdGet, CmdDrop
|
from evennia.commands.default.general import CmdDrop, CmdGet, CmdLook
|
||||||
from evennia.utils import class_from_module
|
from evennia.utils import class_from_module
|
||||||
|
|
||||||
# establish the right inheritance for container objects
|
# establish the right inheritance for container objects
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
from evennia import create_object
|
from evennia import create_object
|
||||||
from evennia.utils.test_resources import BaseEvenniaTest, BaseEvenniaCommandTest # noqa
|
from evennia.utils.test_resources import BaseEvenniaCommandTest, BaseEvenniaTest # noqa
|
||||||
from .containers import ContribContainer, CmdContainerGet, CmdContainerLook, CmdPut
|
|
||||||
|
from .containers import CmdContainerGet, CmdContainerLook, CmdPut, ContribContainer
|
||||||
|
|
||||||
|
|
||||||
class TestContainer(BaseEvenniaTest):
|
class TestContainer(BaseEvenniaTest):
|
||||||
|
|
@ -52,7 +53,7 @@ class TestContainerCmds(BaseEvenniaCommandTest):
|
||||||
# move object to character to try putting
|
# move object to character to try putting
|
||||||
self.obj1.location = self.char1
|
self.obj1.location = self.char1
|
||||||
self.call(CmdPut(), "obj in box", "You can't put things in that.")
|
self.call(CmdPut(), "obj in box", "You can't put things in that.")
|
||||||
|
|
||||||
def test_at_capacity_put(self):
|
def test_at_capacity_put(self):
|
||||||
# set container capacity
|
# set container capacity
|
||||||
self.container.capacity = 1
|
self.container.capacity = 1
|
||||||
|
|
@ -61,5 +62,3 @@ class TestContainerCmds(BaseEvenniaCommandTest):
|
||||||
# move object to character to try putting
|
# move object to character to try putting
|
||||||
self.obj1.location = self.char1
|
self.obj1.location = self.char1
|
||||||
self.call(CmdPut(), "obj in box", "You can't fit anything else in a Box.")
|
self.call(CmdPut(), "obj in box", "You can't fit anything else in a Box.")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -318,7 +318,6 @@ class CraftingRecipeBase:
|
||||||
"""
|
"""
|
||||||
craft_result = None
|
craft_result = None
|
||||||
if self.allow_craft:
|
if self.allow_craft:
|
||||||
|
|
||||||
# override/extend craft_kwargs from initialization.
|
# override/extend craft_kwargs from initialization.
|
||||||
craft_kwargs = copy(self.craft_kwargs)
|
craft_kwargs = copy(self.craft_kwargs)
|
||||||
craft_kwargs.update(kwargs)
|
craft_kwargs.update(kwargs)
|
||||||
|
|
@ -626,7 +625,6 @@ class CraftingRecipe(CraftingRecipeBase):
|
||||||
self.allow_reuse = not bool(self.consumable_tags)
|
self.allow_reuse = not bool(self.consumable_tags)
|
||||||
|
|
||||||
def _format_message(self, message, **kwargs):
|
def _format_message(self, message, **kwargs):
|
||||||
|
|
||||||
missing = iter_to_str(kwargs.get("missing", ""))
|
missing = iter_to_str(kwargs.get("missing", ""))
|
||||||
excess = iter_to_str(kwargs.get("excess", ""))
|
excess = iter_to_str(kwargs.get("excess", ""))
|
||||||
involved_tools = iter_to_str(kwargs.get("tools", ""))
|
involved_tools = iter_to_str(kwargs.get("tools", ""))
|
||||||
|
|
@ -702,7 +700,6 @@ class CraftingRecipe(CraftingRecipeBase):
|
||||||
|
|
||||||
tools = []
|
tools = []
|
||||||
for itag, tag in enumerate(cls.tool_tags):
|
for itag, tag in enumerate(cls.tool_tags):
|
||||||
|
|
||||||
tools.append(
|
tools.append(
|
||||||
create_object(
|
create_object(
|
||||||
key=tool_key or (cls.tool_names[itag] if cls.tool_names else tag.capitalize()),
|
key=tool_key or (cls.tool_names[itag] if cls.tool_names else tag.capitalize()),
|
||||||
|
|
|
||||||
|
|
@ -511,7 +511,6 @@ class CmdCast(Command):
|
||||||
self.target = self.caller
|
self.target = self.caller
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
|
|
||||||
# all items carried by the caller could work
|
# all items carried by the caller could work
|
||||||
possible_tools = self.caller.contents
|
possible_tools = self.caller.contents
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -646,7 +646,6 @@ class CmdUsePuzzleParts(MuxCommand):
|
||||||
return
|
return
|
||||||
|
|
||||||
if not part.tags.get(_PUZZLES_TAG_MEMBER, category=_PUZZLES_TAG_CATEGORY):
|
if not part.tags.get(_PUZZLES_TAG_MEMBER, category=_PUZZLES_TAG_CATEGORY):
|
||||||
|
|
||||||
# not a puzzle part ... abort
|
# not a puzzle part ... abort
|
||||||
caller.msg("You have no idea how %s can be used" % (many))
|
caller.msg("You have no idea how %s can be used" % (many))
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,6 @@ class TestPuzzles(BaseEvenniaCommandTest):
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
def test_cmd_use(self):
|
def test_cmd_use(self):
|
||||||
|
|
||||||
self._use("", "Use what?")
|
self._use("", "Use what?")
|
||||||
self._use("something", "There is no something around.")
|
self._use("something", "There is no something around.")
|
||||||
self._use("steel", "You have no idea how this can be used")
|
self._use("steel", "You have no idea how this can be used")
|
||||||
|
|
|
||||||
|
|
@ -323,7 +323,7 @@ class TBBasicCharacter(DefaultCharacter):
|
||||||
can be changed at creation and factor into combat calculations.
|
can be changed at creation and factor into combat calculations.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def at_pre_move(self, destination, move_type='move', **kwargs):
|
def at_pre_move(self, destination, move_type="move", **kwargs):
|
||||||
"""
|
"""
|
||||||
Called just before starting to move this object to
|
Called just before starting to move this object to
|
||||||
destination.
|
destination.
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,6 @@ class ItemCombatRules(tb_basic.BasicCombatRules):
|
||||||
user.msg("%s has %i uses remaining." % (item.key.capitalize(), item.db.item_uses))
|
user.msg("%s has %i uses remaining." % (item.key.capitalize(), item.db.item_uses))
|
||||||
|
|
||||||
else: # All uses spent
|
else: # All uses spent
|
||||||
|
|
||||||
if not item.db.item_consumable: # Item isn't consumable
|
if not item.db.item_consumable: # Item isn't consumable
|
||||||
# Just inform the player that the uses are gone
|
# Just inform the player that the uses are gone
|
||||||
user.msg("%s has no uses remaining." % item.key.capitalize())
|
user.msg("%s has no uses remaining." % item.key.capitalize())
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ from . import tb_basic, tb_equip, tb_items, tb_magic, tb_range
|
||||||
|
|
||||||
|
|
||||||
class TestTurnBattleBasicCmd(BaseEvenniaCommandTest):
|
class TestTurnBattleBasicCmd(BaseEvenniaCommandTest):
|
||||||
|
|
||||||
# Test basic combat commands
|
# Test basic combat commands
|
||||||
def test_turnbattlecmd(self):
|
def test_turnbattlecmd(self):
|
||||||
self.call(tb_basic.CmdFight(), "", "You can't start a fight if you've been defeated!")
|
self.call(tb_basic.CmdFight(), "", "You can't start a fight if you've been defeated!")
|
||||||
|
|
@ -81,7 +80,6 @@ class TestTurnBattleItemsCmd(BaseEvenniaCommandTest):
|
||||||
|
|
||||||
|
|
||||||
class TestTurnBattleMagicCmd(BaseEvenniaCommandTest):
|
class TestTurnBattleMagicCmd(BaseEvenniaCommandTest):
|
||||||
|
|
||||||
# Test magic commands
|
# Test magic commands
|
||||||
def test_turnbattlemagiccmd(self):
|
def test_turnbattlemagiccmd(self):
|
||||||
self.call(tb_magic.CmdStatus(), "", "You have 100 / 100 HP and 20 / 20 MP.")
|
self.call(tb_magic.CmdStatus(), "", "You have 100 / 100 HP and 20 / 20 MP.")
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ from collections import deque
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from evennia import (
|
from evennia import (
|
||||||
CmdSet,
|
CmdSet,
|
||||||
DefaultRoom,
|
DefaultRoom,
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,12 @@ Testing of ExtendedRoom contrib
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia import create_object
|
|
||||||
from evennia.utils.test_resources import BaseEvenniaCommandTest, EvenniaTestCase
|
|
||||||
from mock import Mock, patch
|
from mock import Mock, patch
|
||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
|
|
||||||
|
from evennia import create_object
|
||||||
|
from evennia.utils.test_resources import BaseEvenniaCommandTest, EvenniaTestCase
|
||||||
|
|
||||||
from . import extended_room
|
from . import extended_room
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,13 @@ create a new wilderness (with the name "default") but using our new map provider
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from evennia import DefaultExit, DefaultRoom, DefaultScript, create_object, create_script
|
from evennia import (
|
||||||
|
DefaultExit,
|
||||||
|
DefaultRoom,
|
||||||
|
DefaultScript,
|
||||||
|
create_object,
|
||||||
|
create_script,
|
||||||
|
)
|
||||||
from evennia.typeclasses.attributes import AttributeProperty
|
from evennia.typeclasses.attributes import AttributeProperty
|
||||||
from evennia.utils import inherits_from
|
from evennia.utils import inherits_from
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,16 @@
|
||||||
XYZGrid - Griatch 2021
|
XYZGrid - Griatch 2021
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from . import example, launchcmd, prototypes, tests, utils, xymap, xymap_legend, xyzgrid, xyzroom
|
from . import (
|
||||||
|
example,
|
||||||
|
launchcmd,
|
||||||
|
prototypes,
|
||||||
|
tests,
|
||||||
|
utils,
|
||||||
|
xymap,
|
||||||
|
xymap_legend,
|
||||||
|
xyzgrid,
|
||||||
|
xyzroom,
|
||||||
|
)
|
||||||
|
|
||||||
from . import commands # isort:skip - this needs to be imported last
|
from . import commands # isort:skip - this needs to be imported last
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ the commands with XYZ-aware equivalents.
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from evennia import CmdSet, InterruptCommand, default_cmds
|
from evennia import CmdSet, InterruptCommand, default_cmds
|
||||||
from evennia.commands.default import building
|
from evennia.commands.default import building
|
||||||
from evennia.contrib.grid.xyzgrid.xyzgrid import get_xyzgrid
|
from evennia.contrib.grid.xyzgrid.xyzgrid import get_xyzgrid
|
||||||
|
|
@ -227,7 +228,6 @@ class CmdGoto(COMMAND_DEFAULT_CLASS):
|
||||||
step_sequence=None,
|
step_sequence=None,
|
||||||
step=True,
|
step=True,
|
||||||
):
|
):
|
||||||
|
|
||||||
path_data = caller.ndb.xy_path_data
|
path_data = caller.ndb.xy_path_data
|
||||||
|
|
||||||
if target:
|
if target:
|
||||||
|
|
@ -244,7 +244,6 @@ class CmdGoto(COMMAND_DEFAULT_CLASS):
|
||||||
)
|
)
|
||||||
|
|
||||||
if step and path_data:
|
if step and path_data:
|
||||||
|
|
||||||
step_sequence = path_data.step_sequence
|
step_sequence = path_data.step_sequence
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,7 @@ MAP2 = r"""
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# custom map node
|
# custom map node
|
||||||
class TransitionToLargeTree(xymap_legend.TransitionMapNode):
|
class TransitionToLargeTree(xymap_legend.TransitionMapNode):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,10 @@ from random import randint
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from evennia.utils.test_resources import BaseEvenniaCommandTest, BaseEvenniaTest
|
|
||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
|
|
||||||
|
from evennia.utils.test_resources import BaseEvenniaCommandTest, BaseEvenniaTest
|
||||||
|
|
||||||
from . import commands, xymap, xymap_legend, xyzgrid, xyzroom
|
from . import commands, xymap, xymap_legend, xyzgrid, xyzroom
|
||||||
|
|
||||||
MAP1 = """
|
MAP1 = """
|
||||||
|
|
|
||||||
|
|
@ -563,7 +563,6 @@ class XYMap:
|
||||||
def _scan_neighbors(
|
def _scan_neighbors(
|
||||||
start_node, points, dist=2, xmin=BIGVAL, ymin=BIGVAL, xmax=0, ymax=0, depth=0
|
start_node, points, dist=2, xmin=BIGVAL, ymin=BIGVAL, xmax=0, ymax=0, depth=0
|
||||||
):
|
):
|
||||||
|
|
||||||
x0, y0 = start_node.x, start_node.y
|
x0, y0 = start_node.x, start_node.y
|
||||||
points.append((x0, y0))
|
points.append((x0, y0))
|
||||||
xmin, xmax = min(xmin, x0), max(xmax, x0)
|
xmin, xmax = min(xmin, x0), max(xmax, x0)
|
||||||
|
|
@ -930,7 +929,7 @@ class XYMap:
|
||||||
# now different from the original for future cropping
|
# now different from the original for future cropping
|
||||||
width, height = xmax - xmin + 1, ymax - ymin + 1
|
width, height = xmax - xmin + 1, ymax - ymin + 1
|
||||||
gridmap = [[" "] * width for _ in range(height)]
|
gridmap = [[" "] * width for _ in range(height)]
|
||||||
for (ix0, iy0) in points:
|
for ix0, iy0 in points:
|
||||||
gridmap[iy0 - ymin][ix0 - xmin] = display_map[iy0][ix0]
|
gridmap[iy0 - ymin][ix0 - xmin] = display_map[iy0][ix0]
|
||||||
|
|
||||||
elif mode == "scan":
|
elif mode == "scan":
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import uuid
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from django.core import exceptions as django_exceptions
|
from django.core import exceptions as django_exceptions
|
||||||
|
|
||||||
from evennia.prototypes import spawner
|
from evennia.prototypes import spawner
|
||||||
from evennia.utils.utils import class_from_module
|
from evennia.utils.utils import class_from_module
|
||||||
|
|
||||||
|
|
@ -182,7 +183,6 @@ class MapNode:
|
||||||
|
|
||||||
# scan in all directions for links
|
# scan in all directions for links
|
||||||
for direction, (dx, dy) in MAPSCAN.items():
|
for direction, (dx, dy) in MAPSCAN.items():
|
||||||
|
|
||||||
lx, ly = x + dx, y + dy
|
lx, ly = x + dx, y + dy
|
||||||
|
|
||||||
if lx in xygrid and ly in xygrid[lx]:
|
if lx in xygrid and ly in xygrid[lx]:
|
||||||
|
|
@ -273,7 +273,6 @@ class MapNode:
|
||||||
return self.X, self.Y, self.Z
|
return self.X, self.Y, self.Z
|
||||||
|
|
||||||
def get_exit_spawn_name(self, direction, return_aliases=True):
|
def get_exit_spawn_name(self, direction, return_aliases=True):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Retrieve the spawn name for the exit being created by this link.
|
Retrieve the spawn name for the exit being created by this link.
|
||||||
|
|
||||||
|
|
@ -365,7 +364,6 @@ class MapNode:
|
||||||
|
|
||||||
maplinks = {}
|
maplinks = {}
|
||||||
for direction, link in self.first_links.items():
|
for direction, link in self.first_links.items():
|
||||||
|
|
||||||
key, *aliases = self.get_exit_spawn_name(direction)
|
key, *aliases = self.get_exit_spawn_name(direction)
|
||||||
if not link.prototype.get("prototype_key"):
|
if not link.prototype.get("prototype_key"):
|
||||||
# generate a deterministic prototype_key if it doesn't exist
|
# generate a deterministic prototype_key if it doesn't exist
|
||||||
|
|
@ -389,7 +387,6 @@ class MapNode:
|
||||||
# build all exits first run)
|
# build all exits first run)
|
||||||
differing_keys = set(maplinks.keys()).symmetric_difference(set(linkobjs.keys()))
|
differing_keys = set(maplinks.keys()).symmetric_difference(set(linkobjs.keys()))
|
||||||
for differing_key in differing_keys:
|
for differing_key in differing_keys:
|
||||||
|
|
||||||
if differing_key not in maplinks:
|
if differing_key not in maplinks:
|
||||||
# an exit without a maplink - delete the exit-object
|
# an exit without a maplink - delete the exit-object
|
||||||
self.log(f" deleting exit at xyz={xyz}, direction={differing_key}")
|
self.log(f" deleting exit at xyz={xyz}, direction={differing_key}")
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,6 @@ class XYZGrid(DefaultScript):
|
||||||
# generate all Maps - this will also initialize their components
|
# generate all Maps - this will also initialize their components
|
||||||
# and bake any pathfinding paths (or load from disk-cache)
|
# and bake any pathfinding paths (or load from disk-cache)
|
||||||
for zcoord, old_mapdata in mapdata.items():
|
for zcoord, old_mapdata in mapdata.items():
|
||||||
|
|
||||||
self.log(f"Loading map '{zcoord}'...")
|
self.log(f"Loading map '{zcoord}'...")
|
||||||
|
|
||||||
# we reload the map from module
|
# we reload the map from module
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ used as stand-alone XYZ-coordinate-aware rooms.
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from evennia.objects.manager import ObjectManager
|
from evennia.objects.manager import ObjectManager
|
||||||
from evennia.objects.objects import DefaultExit, DefaultRoom
|
from evennia.objects.objects import DefaultExit, DefaultRoom
|
||||||
|
|
||||||
|
|
@ -440,7 +441,6 @@ class XYZRoom(DefaultRoom):
|
||||||
xymap = self.xyzgrid.get_map(xyz[2])
|
xymap = self.xyzgrid.get_map(xyz[2])
|
||||||
|
|
||||||
if xymap and kwargs.get("map_display", xymap.options.get("map_display", self.map_display)):
|
if xymap and kwargs.get("map_display", xymap.options.get("map_display", self.map_display)):
|
||||||
|
|
||||||
# show the near-area map.
|
# show the near-area map.
|
||||||
map_character_symbol = kwargs.get(
|
map_character_symbol = kwargs.get(
|
||||||
"map_character_symbol",
|
"map_character_symbol",
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,8 @@ class BaseBuff:
|
||||||
Args:
|
Args:
|
||||||
handler: The handler this buff is attached to
|
handler: The handler this buff is attached to
|
||||||
buffkey: The key this buff uses on the cache
|
buffkey: The key this buff uses on the cache
|
||||||
cache: The cache dictionary (what you get if you use `handler.buffcache.get(key)`)"""
|
cache: The cache dictionary (what you get if you use `handler.buffcache.get(key)`)
|
||||||
|
"""
|
||||||
required = {"handler": handler, "buffkey": buffkey, "cache": cache}
|
required = {"handler": handler, "buffkey": buffkey, "cache": cache}
|
||||||
self.__dict__.update(cache)
|
self.__dict__.update(cache)
|
||||||
self.__dict__.update(required)
|
self.__dict__.update(required)
|
||||||
|
|
@ -196,7 +197,8 @@ class BaseBuff:
|
||||||
loud: (optional) Whether to call at_remove or not (default: True)
|
loud: (optional) Whether to call at_remove or not (default: True)
|
||||||
expire: (optional) Whether to call at_expire or not (default: False)
|
expire: (optional) Whether to call at_expire or not (default: False)
|
||||||
delay: (optional) How long you want to delay the remove call for
|
delay: (optional) How long you want to delay the remove call for
|
||||||
context: (optional) A dictionary you wish to pass to the at_remove/at_expire method as kwargs"""
|
context: (optional) A dictionary you wish to pass to the at_remove/at_expire method as kwargs
|
||||||
|
"""
|
||||||
if not context:
|
if not context:
|
||||||
context = {}
|
context = {}
|
||||||
self.handler.remove(self.buffkey, loud=loud, expire=expire, context=context)
|
self.handler.remove(self.buffkey, loud=loud, expire=expire, context=context)
|
||||||
|
|
@ -207,7 +209,8 @@ class BaseBuff:
|
||||||
Args:
|
Args:
|
||||||
loud: (optional) Whether to call at_remove or not (default: True)
|
loud: (optional) Whether to call at_remove or not (default: True)
|
||||||
delay: (optional) How long you want to delay the remove call for
|
delay: (optional) How long you want to delay the remove call for
|
||||||
context: (optional) A dictionary you wish to pass to the at_remove/at_dispel method as kwargs"""
|
context: (optional) A dictionary you wish to pass to the at_remove/at_dispel method as kwargs
|
||||||
|
"""
|
||||||
if not context:
|
if not context:
|
||||||
context = {}
|
context = {}
|
||||||
self.handler.remove(self.buffkey, loud=loud, dispel=True, delay=delay, context=context)
|
self.handler.remove(self.buffkey, loud=loud, dispel=True, delay=delay, context=context)
|
||||||
|
|
@ -225,7 +228,8 @@ class BaseBuff:
|
||||||
"""Helper method which unpauses this buff on its handler.
|
"""Helper method which unpauses this buff on its handler.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
context: (optional) A dictionary you wish to pass to the at_unpause method as kwargs"""
|
context: (optional) A dictionary you wish to pass to the at_unpause method as kwargs
|
||||||
|
"""
|
||||||
if not context:
|
if not context:
|
||||||
context = {}
|
context = {}
|
||||||
self.handler.unpause(self.buffkey, context)
|
self.handler.unpause(self.buffkey, context)
|
||||||
|
|
@ -322,7 +326,6 @@ class Mod:
|
||||||
|
|
||||||
|
|
||||||
class BuffHandler:
|
class BuffHandler:
|
||||||
|
|
||||||
ownerref = None
|
ownerref = None
|
||||||
dbkey = "buffs"
|
dbkey = "buffs"
|
||||||
autopause = False
|
autopause = False
|
||||||
|
|
@ -333,7 +336,8 @@ class BuffHandler:
|
||||||
Args:
|
Args:
|
||||||
owner: The object this handler is attached to
|
owner: The object this handler is attached to
|
||||||
dbkey: (optional) The string key of the db attribute to use for the buff cache
|
dbkey: (optional) The string key of the db attribute to use for the buff cache
|
||||||
autopause: (optional) Whether this handler autopauses playtime buffs on owning object's unpuppet"""
|
autopause: (optional) Whether this handler autopauses playtime buffs on owning object's unpuppet
|
||||||
|
"""
|
||||||
self.ownerref = owner.dbref
|
self.ownerref = owner.dbref
|
||||||
self.dbkey = dbkey
|
self.dbkey = dbkey
|
||||||
self.autopause = autopause
|
self.autopause = autopause
|
||||||
|
|
@ -434,7 +438,6 @@ class BuffHandler:
|
||||||
*args,
|
*args,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
|
|
||||||
"""Add a buff to this object, respecting all stacking/refresh/reapplication rules. Takes
|
"""Add a buff to this object, respecting all stacking/refresh/reapplication rules. Takes
|
||||||
a number of optional parameters to allow for customization.
|
a number of optional parameters to allow for customization.
|
||||||
|
|
||||||
|
|
@ -702,7 +705,8 @@ class BuffHandler:
|
||||||
buff: The buff class to search for
|
buff: The buff class to search for
|
||||||
to_filter: (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.
|
to_filter: (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.
|
||||||
|
|
||||||
Returns a dictionary of instanced buffs of the specified type in the format {buffkey: instance}."""
|
Returns a dictionary of instanced buffs of the specified type in the format {buffkey: instance}.
|
||||||
|
"""
|
||||||
_cache = self.get_all() if not to_filter else to_filter
|
_cache = self.get_all() if not to_filter else to_filter
|
||||||
return {k: _buff for k, _buff in _cache.items() if isinstance(_buff, buff)}
|
return {k: _buff for k, _buff in _cache.items() if isinstance(_buff, buff)}
|
||||||
|
|
||||||
|
|
@ -713,7 +717,8 @@ class BuffHandler:
|
||||||
stat: The string identifier to find relevant mods
|
stat: The string identifier to find relevant mods
|
||||||
to_filter: (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.
|
to_filter: (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.
|
||||||
|
|
||||||
Returns a dictionary of instanced buffs which modify the specified stat in the format {buffkey: instance}."""
|
Returns a dictionary of instanced buffs which modify the specified stat in the format {buffkey: instance}.
|
||||||
|
"""
|
||||||
_cache = self.traits if not to_filter else to_filter
|
_cache = self.traits if not to_filter else to_filter
|
||||||
buffs = {k: buff for k, buff in _cache.items() for m in buff.mods if m.stat == stat}
|
buffs = {k: buff for k, buff in _cache.items() for m in buff.mods if m.stat == stat}
|
||||||
return buffs
|
return buffs
|
||||||
|
|
@ -725,7 +730,8 @@ class BuffHandler:
|
||||||
trigger: The string identifier to find relevant buffs
|
trigger: The string identifier to find relevant buffs
|
||||||
to_filter: (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.
|
to_filter: (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.
|
||||||
|
|
||||||
Returns a dictionary of instanced buffs which fire off the designated trigger, in the format {buffkey: instance}."""
|
Returns a dictionary of instanced buffs which fire off the designated trigger, in the format {buffkey: instance}.
|
||||||
|
"""
|
||||||
_cache = self.effects if not to_filter else to_filter
|
_cache = self.effects if not to_filter else to_filter
|
||||||
buffs = {k: buff for k, buff in _cache.items() if trigger in buff.triggers}
|
buffs = {k: buff for k, buff in _cache.items() if trigger in buff.triggers}
|
||||||
return buffs
|
return buffs
|
||||||
|
|
@ -737,7 +743,8 @@ class BuffHandler:
|
||||||
source: The source you want to filter buffs by
|
source: The source you want to filter buffs by
|
||||||
to_filter: (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.
|
to_filter: (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.
|
||||||
|
|
||||||
Returns a dictionary of instanced buffs which came from the provided source, in the format {buffkey: instance}."""
|
Returns a dictionary of instanced buffs which came from the provided source, in the format {buffkey: instance}.
|
||||||
|
"""
|
||||||
_cache = self.all if not to_filter else to_filter
|
_cache = self.all if not to_filter else to_filter
|
||||||
buffs = {k: buff for k, buff in _cache.items() if buff.source == source}
|
buffs = {k: buff for k, buff in _cache.items() if buff.source == source}
|
||||||
return buffs
|
return buffs
|
||||||
|
|
@ -750,7 +757,8 @@ class BuffHandler:
|
||||||
value: (optional) The value to match to. If None, merely checks to see if the value exists
|
value: (optional) The value to match to. If None, merely checks to see if the value exists
|
||||||
to_filter: (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.
|
to_filter: (optional) A dictionary you wish to slice. If not provided, uses the whole buffcache.
|
||||||
|
|
||||||
Returns a dictionary of instanced buffs with cache values matching the specified value, in the format {buffkey: instance}."""
|
Returns a dictionary of instanced buffs with cache values matching the specified value, in the format {buffkey: instance}.
|
||||||
|
"""
|
||||||
_cache = self.all if not to_filter else to_filter
|
_cache = self.all if not to_filter else to_filter
|
||||||
if not value:
|
if not value:
|
||||||
buffs = {k: buff for k, buff in _cache.items() if buff.cache.get(key)}
|
buffs = {k: buff for k, buff in _cache.items() if buff.cache.get(key)}
|
||||||
|
|
@ -907,7 +915,8 @@ class BuffHandler:
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
key: The key for the buff you wish to pause
|
key: The key for the buff you wish to pause
|
||||||
context: (optional) A dictionary you wish to pass to the at_unpause method as kwargs"""
|
context: (optional) A dictionary you wish to pass to the at_unpause method as kwargs
|
||||||
|
"""
|
||||||
if key in self.buffcache.keys():
|
if key in self.buffcache.keys():
|
||||||
# Mark the buff as unpaused
|
# Mark the buff as unpaused
|
||||||
buff = dict(self.buffcache.get(key))
|
buff = dict(self.buffcache.get(key))
|
||||||
|
|
@ -945,7 +954,8 @@ class BuffHandler:
|
||||||
"""Returns a buff flavor text as a dictionary of tuples in the format {key: (name, flavor)}. Common use for this is a buff readout of some kind.
|
"""Returns a buff flavor text as a dictionary of tuples in the format {key: (name, flavor)}. Common use for this is a buff readout of some kind.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
to_filter: (optional) The dictionary of buffs to iterate over. If none is provided, returns all buffs (default: None)"""
|
to_filter: (optional) The dictionary of buffs to iterate over. If none is provided, returns all buffs (default: None)
|
||||||
|
"""
|
||||||
if not isinstance(to_filter, dict):
|
if not isinstance(to_filter, dict):
|
||||||
raise TypeError
|
raise TypeError
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
|
|
@ -1156,7 +1166,8 @@ def tick_buff(handler: BuffHandler, buffkey: str, context=None, initial=True):
|
||||||
handler: The handler managing the ticking buff
|
handler: The handler managing the ticking buff
|
||||||
buffkey: The key of the ticking buff
|
buffkey: The key of the ticking buff
|
||||||
context: (optional) A dictionary you wish to pass to the at_tick method as kwargs
|
context: (optional) A dictionary you wish to pass to the at_tick method as kwargs
|
||||||
initial: (optional) Whether this tick_buff call is the first one. Starts True, changes to False for future ticks"""
|
initial: (optional) Whether this tick_buff call is the first one. Starts True, changes to False for future ticks
|
||||||
|
"""
|
||||||
# Cache a reference and find the buff on the object
|
# Cache a reference and find the buff on the object
|
||||||
if buffkey not in handler.buffcache.keys():
|
if buffkey not in handler.buffcache.keys():
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -302,8 +302,7 @@ class CmdDice(default_cmds.MuxCommand):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.caller.msg(
|
self.caller.msg(
|
||||||
"You need to enter valid integer numbers, modifiers and operators."
|
"You need to enter valid integer numbers, modifiers and operators."
|
||||||
" |w%s|n was not understood."
|
" |w%s|n was not understood." % self.args
|
||||||
% self.args
|
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
# format output
|
# format output
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,10 @@ Testing of TestDice.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from evennia.commands.default.tests import BaseEvenniaCommandTest
|
|
||||||
from mock import patch
|
from mock import patch
|
||||||
|
|
||||||
|
from evennia.commands.default.tests import BaseEvenniaCommandTest
|
||||||
|
|
||||||
from . import dice
|
from . import dice
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@ DEFAULT_LLM_REQUEST_BODY = {...} # see below, this controls how to prompt the
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia import logger
|
|
||||||
from evennia.utils.utils import make_iter
|
|
||||||
from twisted.internet import defer, protocol, reactor
|
from twisted.internet import defer, protocol, reactor
|
||||||
from twisted.internet.defer import inlineCallbacks
|
from twisted.internet.defer import inlineCallbacks
|
||||||
from twisted.web.client import Agent, HTTPConnectionPool, _HTTP11ClientFactory
|
from twisted.web.client import Agent, HTTPConnectionPool, _HTTP11ClientFactory
|
||||||
|
|
@ -34,6 +32,9 @@ from twisted.web.http_headers import Headers
|
||||||
from twisted.web.iweb import IBodyProducer
|
from twisted.web.iweb import IBodyProducer
|
||||||
from zope.interface import implementer
|
from zope.interface import implementer
|
||||||
|
|
||||||
|
from evennia import logger
|
||||||
|
from evennia.utils.utils import make_iter
|
||||||
|
|
||||||
DEFAULT_LLM_HOST = "http://127.0.0.1:5000"
|
DEFAULT_LLM_HOST = "http://127.0.0.1:5000"
|
||||||
DEFAULT_LLM_PATH = "/api/v1/generate"
|
DEFAULT_LLM_PATH = "/api/v1/generate"
|
||||||
DEFAULT_LLM_HEADERS = {"Content-Type": "application/json"}
|
DEFAULT_LLM_HEADERS = {"Content-Type": "application/json"}
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,12 @@ from collections import defaultdict
|
||||||
from random import choice
|
from random import choice
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia import AttributeProperty, Command, DefaultCharacter
|
|
||||||
from evennia.utils.utils import make_iter
|
|
||||||
from twisted.internet import reactor, task
|
from twisted.internet import reactor, task
|
||||||
from twisted.internet.defer import CancelledError, inlineCallbacks
|
from twisted.internet.defer import CancelledError, inlineCallbacks
|
||||||
|
|
||||||
|
from evennia import AttributeProperty, Command, DefaultCharacter
|
||||||
|
from evennia.utils.utils import make_iter
|
||||||
|
|
||||||
from .llm_client import LLMClient
|
from .llm_client import LLMClient
|
||||||
|
|
||||||
# fallback if not specified anywhere else. Check order is
|
# fallback if not specified anywhere else. Check order is
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,10 @@ Unit tests for the LLM Client and npc.
|
||||||
|
|
||||||
from anything import Something
|
from anything import Something
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
|
from mock import Mock, patch
|
||||||
|
|
||||||
from evennia.utils.create import create_object
|
from evennia.utils.create import create_object
|
||||||
from evennia.utils.test_resources import EvenniaTestCase
|
from evennia.utils.test_resources import EvenniaTestCase
|
||||||
from mock import Mock, patch
|
|
||||||
|
|
||||||
from .llm_npc import LLMNPC
|
from .llm_npc import LLMNPC
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,12 +154,18 @@ from string import punctuation
|
||||||
|
|
||||||
import inflect
|
import inflect
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from evennia.commands.cmdset import CmdSet
|
from evennia.commands.cmdset import CmdSet
|
||||||
from evennia.commands.command import Command
|
from evennia.commands.command import Command
|
||||||
from evennia.objects.models import ObjectDB
|
from evennia.objects.models import ObjectDB
|
||||||
from evennia.objects.objects import DefaultCharacter, DefaultObject
|
from evennia.objects.objects import DefaultCharacter, DefaultObject
|
||||||
from evennia.utils import ansi, logger
|
from evennia.utils import ansi, logger
|
||||||
from evennia.utils.utils import iter_to_str, lazy_property, make_iter, variable_from_module
|
from evennia.utils.utils import (
|
||||||
|
iter_to_str,
|
||||||
|
lazy_property,
|
||||||
|
make_iter,
|
||||||
|
variable_from_module,
|
||||||
|
)
|
||||||
|
|
||||||
_INFLECT = inflect.engine()
|
_INFLECT = inflect.engine()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ Tests for RP system
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from anything import Anything
|
from anything import Anything
|
||||||
|
|
||||||
from evennia import create_object
|
from evennia import create_object
|
||||||
from evennia.commands.default.tests import BaseEvenniaCommandTest
|
from evennia.commands.default.tests import BaseEvenniaCommandTest
|
||||||
from evennia.utils.test_resources import BaseEvenniaTest
|
from evennia.utils.test_resources import BaseEvenniaTest
|
||||||
|
|
@ -329,7 +330,6 @@ class TestRPSystemCommands(BaseEvenniaCommandTest):
|
||||||
self.char2.swap_typeclass(rpsystem.ContribRPCharacter)
|
self.char2.swap_typeclass(rpsystem.ContribRPCharacter)
|
||||||
|
|
||||||
def test_commands(self):
|
def test_commands(self):
|
||||||
|
|
||||||
self.call(
|
self.call(
|
||||||
rpsystem.CmdSdesc(), "Foobar Character", "Char's sdesc was set to 'Foobar Character'."
|
rpsystem.CmdSdesc(), "Foobar Character", "Char's sdesc was set to 'Foobar Character'."
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ EvAdventure character generation.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from evennia.objects.models import ObjectDB
|
from evennia.objects.models import ObjectDB
|
||||||
from evennia.prototypes.spawner import spawn
|
from evennia.prototypes.spawner import spawn
|
||||||
from evennia.utils.create import create_object
|
from evennia.utils.create import create_object
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,14 @@ This implements a 'twitch' (aka DIKU or other traditional muds) style of MUD com
|
||||||
"""
|
"""
|
||||||
from evennia import AttributeProperty, CmdSet, default_cmds
|
from evennia import AttributeProperty, CmdSet, default_cmds
|
||||||
from evennia.commands.command import Command, InterruptCommand
|
from evennia.commands.command import Command, InterruptCommand
|
||||||
from evennia.utils.utils import display_len, inherits_from, list_to_string, pad, repeat, unrepeat
|
from evennia.utils.utils import (
|
||||||
|
display_len,
|
||||||
|
inherits_from,
|
||||||
|
list_to_string,
|
||||||
|
pad,
|
||||||
|
repeat,
|
||||||
|
unrepeat,
|
||||||
|
)
|
||||||
|
|
||||||
from .characters import EvAdventureCharacter
|
from .characters import EvAdventureCharacter
|
||||||
from .combat_base import (
|
from .combat_base import (
|
||||||
|
|
|
||||||
|
|
@ -316,11 +316,9 @@ class EvAdventureRollEngine:
|
||||||
setattr(character, abi, current_abi)
|
setattr(character, abi, current_abi)
|
||||||
|
|
||||||
character.msg(
|
character.msg(
|
||||||
"~" * 78
|
"~" * 78 + "\n|yYou survive your brush with death, "
|
||||||
+ "\n|yYou survive your brush with death, "
|
|
||||||
f"but are |r{result.upper()}|y and permanently |rlose {loss} {abi}|y.|n\n"
|
f"but are |r{result.upper()}|y and permanently |rlose {loss} {abi}|y.|n\n"
|
||||||
f"|GYou recover |g{new_hp}|G health|.\n"
|
f"|GYou recover |g{new_hp}|G health|.\n" + "~" * 78
|
||||||
+ "~" * 78
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ class EvAdventureCharacterGenerationTest(BaseEvenniaTest):
|
||||||
|
|
||||||
@patch("evennia.contrib.tutorials.evadventure.chargen.spawn")
|
@patch("evennia.contrib.tutorials.evadventure.chargen.spawn")
|
||||||
def test_apply(self, mock_spawn):
|
def test_apply(self, mock_spawn):
|
||||||
|
|
||||||
gambeson = create_object(objects.EvAdventureArmor, key="gambeson")
|
gambeson = create_object(objects.EvAdventureArmor, key="gambeson")
|
||||||
mock_spawn.return_value = [gambeson]
|
mock_spawn.return_value = [gambeson]
|
||||||
account = MagicMock()
|
account = MagicMock()
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,11 @@ from unittest.mock import Mock, call, patch
|
||||||
|
|
||||||
from evennia.utils import create
|
from evennia.utils import create
|
||||||
from evennia.utils.ansi import strip_ansi
|
from evennia.utils.ansi import strip_ansi
|
||||||
from evennia.utils.test_resources import BaseEvenniaTest, EvenniaCommandTestMixin, EvenniaTestCase
|
from evennia.utils.test_resources import (
|
||||||
|
BaseEvenniaTest,
|
||||||
|
EvenniaCommandTestMixin,
|
||||||
|
EvenniaTestCase,
|
||||||
|
)
|
||||||
|
|
||||||
from .. import combat_base, combat_turnbased, combat_twitch
|
from .. import combat_base, combat_turnbased, combat_twitch
|
||||||
from ..characters import EvAdventureCharacter
|
from ..characters import EvAdventureCharacter
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ Test the EvAdventure commands.
|
||||||
from unittest.mock import call, patch
|
from unittest.mock import call, patch
|
||||||
|
|
||||||
from anything import Something
|
from anything import Something
|
||||||
|
|
||||||
from evennia.utils.create import create_object
|
from evennia.utils.create import create_object
|
||||||
from evennia.utils.test_resources import BaseEvenniaCommandTest
|
from evennia.utils.test_resources import BaseEvenniaCommandTest
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ from ..objects import EvAdventureObject
|
||||||
|
|
||||||
class TestUtils(BaseEvenniaTest):
|
class TestUtils(BaseEvenniaTest):
|
||||||
def test_get_obj_stats(self):
|
def test_get_obj_stats(self):
|
||||||
|
|
||||||
obj = create.create_object(
|
obj = create.create_object(
|
||||||
EvAdventureObject, key="testobj", attributes=(("desc", "A test object"),)
|
EvAdventureObject, key="testobj", attributes=(("desc", "A test object"),)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -748,7 +748,6 @@ class TutorialEvMenu(EvMenu):
|
||||||
self.caller.account.execute_cmd("unquell")
|
self.caller.account.execute_cmd("unquell")
|
||||||
|
|
||||||
def options_formatter(self, optionslist):
|
def options_formatter(self, optionslist):
|
||||||
|
|
||||||
navigation_keys = ("next", "back", "back to start")
|
navigation_keys = ("next", "back", "back to start")
|
||||||
|
|
||||||
other = []
|
other = []
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,6 @@ def parse_entry_for_subcategories(entry):
|
||||||
|
|
||||||
# from evennia import set_trace;set_trace()
|
# from evennia import set_trace;set_trace()
|
||||||
for part in _RE_HELP_SUBTOPIC_SPLIT.split(subtopics.strip()):
|
for part in _RE_HELP_SUBTOPIC_SPLIT.split(subtopics.strip()):
|
||||||
|
|
||||||
subtopic_match = _RE_HELP_SUBTOPIC_PARSE.match(part.strip())
|
subtopic_match = _RE_HELP_SUBTOPIC_PARSE.match(part.strip())
|
||||||
if subtopic_match:
|
if subtopic_match:
|
||||||
# a new sub(-sub..) category starts.
|
# a new sub(-sub..) category starts.
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ a certain object type.
|
||||||
from ast import literal_eval
|
from ast import literal_eval
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from evennia.utils import utils
|
from evennia.utils import utils
|
||||||
|
|
||||||
_PERMISSION_HIERARCHY = [pe.lower() for pe in settings.PERMISSION_HIERARCHY]
|
_PERMISSION_HIERARCHY = [pe.lower() for pe in settings.PERMISSION_HIERARCHY]
|
||||||
|
|
|
||||||
|
|
@ -451,7 +451,6 @@ class ObjectDBManager(TypedObjectManager):
|
||||||
return query
|
return query
|
||||||
|
|
||||||
if not searchdata and searchdata != 0:
|
if not searchdata and searchdata != 0:
|
||||||
|
|
||||||
if tags:
|
if tags:
|
||||||
return _search_by_tag(make_iter(tags))
|
return _search_by_tag(make_iter(tags))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,11 @@ This is the v1.0 develop version (for ref in doc building).
|
||||||
import time
|
import time
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
import evennia
|
|
||||||
import inflect
|
import inflect
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
import evennia
|
||||||
from evennia.commands import cmdset
|
from evennia.commands import cmdset
|
||||||
from evennia.commands.cmdsethandler import CmdSetHandler
|
from evennia.commands.cmdsethandler import CmdSetHandler
|
||||||
from evennia.objects.manager import ObjectManager
|
from evennia.objects.manager import ObjectManager
|
||||||
|
|
|
||||||
|
|
@ -462,7 +462,6 @@ def _search_object(caller):
|
||||||
is_account = searchstring.startswith("*")
|
is_account = searchstring.startswith("*")
|
||||||
|
|
||||||
if is_dbref or is_account:
|
if is_dbref or is_account:
|
||||||
|
|
||||||
if is_dbref:
|
if is_dbref:
|
||||||
# a dbref search
|
# a dbref search
|
||||||
results = caller.search(searchstring, global_search=True, quiet=True)
|
results = caller.search(searchstring, global_search=True, quiet=True)
|
||||||
|
|
@ -508,14 +507,12 @@ def _object_search_actions(caller, raw_inp, **kwargs):
|
||||||
raw_inp = raw_inp.strip()
|
raw_inp = raw_inp.strip()
|
||||||
|
|
||||||
if obj_entry:
|
if obj_entry:
|
||||||
|
|
||||||
num = choices.index(obj_entry)
|
num = choices.index(obj_entry)
|
||||||
matches = caller.ndb._menutree.olc_search_object_matches
|
matches = caller.ndb._menutree.olc_search_object_matches
|
||||||
obj = matches[num]
|
obj = matches[num]
|
||||||
prot = spawner.prototype_from_object(obj)
|
prot = spawner.prototype_from_object(obj)
|
||||||
|
|
||||||
if action == "examine":
|
if action == "examine":
|
||||||
|
|
||||||
if not obj.access(caller, "examine"):
|
if not obj.access(caller, "examine"):
|
||||||
caller.msg("\n|rYou don't have 'examine' access on this object.|n")
|
caller.msg("\n|rYou don't have 'examine' access on this object.|n")
|
||||||
del caller.ndb._menutree.olc_search_object_term
|
del caller.ndb._menutree.olc_search_object_term
|
||||||
|
|
@ -738,7 +735,6 @@ def _check_prototype_key(caller, key):
|
||||||
|
|
||||||
|
|
||||||
def node_prototype_key(caller):
|
def node_prototype_key(caller):
|
||||||
|
|
||||||
text = """
|
text = """
|
||||||
The |cPrototype-Key|n uniquely identifies the prototype and is |wmandatory|n. It is used to
|
The |cPrototype-Key|n uniquely identifies the prototype and is |wmandatory|n. It is used to
|
||||||
find and use the prototype to spawn new entities. It is not case sensitive.
|
find and use the prototype to spawn new entities. It is not case sensitive.
|
||||||
|
|
@ -840,7 +836,6 @@ def _prototype_parent_actions(caller, raw_inp, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def _prototype_parent_select(caller, new_parent):
|
def _prototype_parent_select(caller, new_parent):
|
||||||
|
|
||||||
ret = None
|
ret = None
|
||||||
prototype_parent = protlib.search_prototype(new_parent)
|
prototype_parent = protlib.search_prototype(new_parent)
|
||||||
try:
|
try:
|
||||||
|
|
@ -1090,7 +1085,6 @@ def _aliases_actions(caller, raw_inp, **kwargs):
|
||||||
|
|
||||||
@list_node(_all_aliases, _aliases_select)
|
@list_node(_all_aliases, _aliases_select)
|
||||||
def node_aliases(caller):
|
def node_aliases(caller):
|
||||||
|
|
||||||
text = """
|
text = """
|
||||||
|cAliases|n are alternative ways to address an object, next to its |cKey|n. Aliases are not
|
|cAliases|n are alternative ways to address an object, next to its |cKey|n. Aliases are not
|
||||||
case sensitive.
|
case sensitive.
|
||||||
|
|
@ -1393,7 +1387,6 @@ def _add_tag(caller, tag_string, **kwargs):
|
||||||
old_tag = _get_tup_by_tagname(caller, tag)
|
old_tag = _get_tup_by_tagname(caller, tag)
|
||||||
|
|
||||||
if "delete" in kwargs:
|
if "delete" in kwargs:
|
||||||
|
|
||||||
if old_tag:
|
if old_tag:
|
||||||
tags.pop(tags.index(old_tag))
|
tags.pop(tags.index(old_tag))
|
||||||
text = "Removed Tag '{}'.".format(tag)
|
text = "Removed Tag '{}'.".format(tag)
|
||||||
|
|
@ -1745,7 +1738,6 @@ def node_permissions(caller):
|
||||||
|
|
||||||
|
|
||||||
def node_location(caller):
|
def node_location(caller):
|
||||||
|
|
||||||
text = """
|
text = """
|
||||||
The |cLocation|n of this object in the world. If not given, the object will spawn in the
|
The |cLocation|n of this object in the world. If not given, the object will spawn in the
|
||||||
inventory of |c{caller}|n by default.
|
inventory of |c{caller}|n by default.
|
||||||
|
|
@ -1782,7 +1774,6 @@ def node_location(caller):
|
||||||
|
|
||||||
|
|
||||||
def node_home(caller):
|
def node_home(caller):
|
||||||
|
|
||||||
text = """
|
text = """
|
||||||
The |cHome|n location of an object is often only used as a backup - this is where the object
|
The |cHome|n location of an object is often only used as a backup - this is where the object
|
||||||
will be moved to if its location is deleted. The home location can also be used as an actual
|
will be moved to if its location is deleted. The home location can also be used as an actual
|
||||||
|
|
@ -1823,7 +1814,6 @@ def node_home(caller):
|
||||||
|
|
||||||
|
|
||||||
def node_destination(caller):
|
def node_destination(caller):
|
||||||
|
|
||||||
text = """
|
text = """
|
||||||
The object's |cDestination|n is generally only used by Exit-like objects to designate where
|
The object's |cDestination|n is generally only used by Exit-like objects to designate where
|
||||||
the exit 'leads to'. It's usually unset for all other types of objects.
|
the exit 'leads to'. It's usually unset for all other types of objects.
|
||||||
|
|
@ -1859,7 +1849,6 @@ def node_destination(caller):
|
||||||
|
|
||||||
|
|
||||||
def node_prototype_desc(caller):
|
def node_prototype_desc(caller):
|
||||||
|
|
||||||
text = """
|
text = """
|
||||||
The |cPrototype-Description|n briefly describes the prototype when it's viewed in listings.
|
The |cPrototype-Description|n briefly describes the prototype when it's viewed in listings.
|
||||||
|
|
||||||
|
|
@ -1967,7 +1956,6 @@ def _prototype_tags_actions(caller, raw_inp, **kwargs):
|
||||||
|
|
||||||
@list_node(_caller_prototype_tags, _prototype_tag_select)
|
@list_node(_caller_prototype_tags, _prototype_tag_select)
|
||||||
def node_prototype_tags(caller):
|
def node_prototype_tags(caller):
|
||||||
|
|
||||||
text = """
|
text = """
|
||||||
|cPrototype-Tags|n can be used to classify and find prototypes in listings Tag names are not
|
|cPrototype-Tags|n can be used to classify and find prototypes in listings Tag names are not
|
||||||
case-sensitive and can have not have a custom category.
|
case-sensitive and can have not have a custom category.
|
||||||
|
|
@ -2067,7 +2055,6 @@ def _prototype_locks_actions(caller, raw_inp, **kwargs):
|
||||||
|
|
||||||
@list_node(_caller_prototype_locks, _prototype_lock_select)
|
@list_node(_caller_prototype_locks, _prototype_lock_select)
|
||||||
def node_prototype_locks(caller):
|
def node_prototype_locks(caller):
|
||||||
|
|
||||||
text = """
|
text = """
|
||||||
|cPrototype-Locks|n are used to limit access to this prototype when someone else is trying
|
|cPrototype-Locks|n are used to limit access to this prototype when someone else is trying
|
||||||
to access it. By default any prototype can be edited only by the creator and by Admins while
|
to access it. By default any prototype can be edited only by the creator and by Admins while
|
||||||
|
|
@ -2608,7 +2595,6 @@ def _prototype_load_actions(caller, raw_inp, **kwargs):
|
||||||
)
|
)
|
||||||
|
|
||||||
if prototype:
|
if prototype:
|
||||||
|
|
||||||
# which action to apply on the selection
|
# which action to apply on the selection
|
||||||
if action == "examine":
|
if action == "examine":
|
||||||
# examine the prototype
|
# examine the prototype
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ from django.conf import settings
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from evennia.locks.lockhandler import check_lockstring, validate_lockstring
|
from evennia.locks.lockhandler import check_lockstring, validate_lockstring
|
||||||
from evennia.objects.models import ObjectDB
|
from evennia.objects.models import ObjectDB
|
||||||
from evennia.scripts.scripts import DefaultScript
|
from evennia.scripts.scripts import DefaultScript
|
||||||
|
|
|
||||||
|
|
@ -137,9 +137,10 @@ import copy
|
||||||
import hashlib
|
import hashlib
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import evennia
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
import evennia
|
||||||
from evennia.objects.models import ObjectDB
|
from evennia.objects.models import ObjectDB
|
||||||
from evennia.prototypes import prototypes as protlib
|
from evennia.prototypes import prototypes as protlib
|
||||||
from evennia.prototypes.prototypes import (
|
from evennia.prototypes.prototypes import (
|
||||||
|
|
@ -396,7 +397,6 @@ def prototype_diff(prototype1, prototype2, maxdepth=2, homogenize=False, implici
|
||||||
_unset = Unset()
|
_unset = Unset()
|
||||||
|
|
||||||
def _recursive_diff(old, new, depth=0):
|
def _recursive_diff(old, new, depth=0):
|
||||||
|
|
||||||
old_type = type(old)
|
old_type = type(old)
|
||||||
new_type = type(new)
|
new_type = type(new)
|
||||||
|
|
||||||
|
|
@ -693,7 +693,6 @@ def batch_update_objects_with_prototype(
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for key, directive in diff.items():
|
for key, directive in diff.items():
|
||||||
|
|
||||||
if key not in new_prototype and not exact:
|
if key not in new_prototype and not exact:
|
||||||
# we don't update the object if the prototype does not actually
|
# we don't update the object if the prototype does not actually
|
||||||
# contain the key (the diff will report REMOVE but we ignore it
|
# contain the key (the diff will report REMOVE but we ignore it
|
||||||
|
|
@ -701,7 +700,6 @@ def batch_update_objects_with_prototype(
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if directive in ("UPDATE", "REPLACE"):
|
if directive in ("UPDATE", "REPLACE"):
|
||||||
|
|
||||||
if key in _PROTOTYPE_META_NAMES:
|
if key in _PROTOTYPE_META_NAMES:
|
||||||
# prototype meta keys are not stored on-object
|
# prototype meta keys are not stored on-object
|
||||||
continue
|
continue
|
||||||
|
|
@ -855,7 +853,6 @@ def batch_create_object(*objparams):
|
||||||
|
|
||||||
objs = []
|
objs = []
|
||||||
for objparam in objparams:
|
for objparam in objparams:
|
||||||
|
|
||||||
obj = ObjectDB(**objparam[0])
|
obj = ObjectDB(**objparam[0])
|
||||||
|
|
||||||
# setup
|
# setup
|
||||||
|
|
@ -930,7 +927,6 @@ def spawn(*prototypes, caller=None, **kwargs):
|
||||||
|
|
||||||
objsparams = []
|
objsparams = []
|
||||||
for prototype in prototypes:
|
for prototype in prototypes:
|
||||||
|
|
||||||
# run validation and homogenization of provided prototypes
|
# run validation and homogenization of provided prototypes
|
||||||
protlib.validate_prototype(
|
protlib.validate_prototype(
|
||||||
prototype, None, protparents=custom_protparents, is_prototype_base=True
|
prototype, None, protparents=custom_protparents, is_prototype_base=True
|
||||||
|
|
@ -996,7 +992,7 @@ def spawn(*prototypes, caller=None, **kwargs):
|
||||||
|
|
||||||
val = prot.pop("tags", [])
|
val = prot.pop("tags", [])
|
||||||
tags = []
|
tags = []
|
||||||
for (tag, category, *data) in val:
|
for tag, category, *data in val:
|
||||||
tags.append(
|
tags.append(
|
||||||
(
|
(
|
||||||
init_spawn_value(tag, str, **init_spawn_kwargs),
|
init_spawn_value(tag, str, **init_spawn_kwargs),
|
||||||
|
|
@ -1026,7 +1022,7 @@ def spawn(*prototypes, caller=None, **kwargs):
|
||||||
# the rest are attribute tuples (attrname, value, category, locks)
|
# the rest are attribute tuples (attrname, value, category, locks)
|
||||||
val = make_iter(prot.pop("attrs", []))
|
val = make_iter(prot.pop("attrs", []))
|
||||||
attributes = []
|
attributes = []
|
||||||
for (attrname, value, *rest) in val:
|
for attrname, value, *rest in val:
|
||||||
attributes.append(
|
attributes.append(
|
||||||
(
|
(
|
||||||
attrname,
|
attrname,
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ from time import time
|
||||||
import mock
|
import mock
|
||||||
from anything import Something
|
from anything import Something
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
|
|
||||||
from evennia.commands.default import building
|
from evennia.commands.default import building
|
||||||
from evennia.objects.models import ObjectDB
|
from evennia.objects.models import ObjectDB
|
||||||
from evennia.prototypes import menus as olc_menus
|
from evennia.prototypes import menus as olc_menus
|
||||||
|
|
@ -135,7 +136,6 @@ class TestUtils(BaseEvenniaTest):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_update_objects_from_prototypes(self):
|
def test_update_objects_from_prototypes(self):
|
||||||
|
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.obj1.attributes.add("oldtest", "to_keep")
|
self.obj1.attributes.add("oldtest", "to_keep")
|
||||||
|
|
||||||
|
|
@ -438,7 +438,6 @@ class TestPrototypeStorage(BaseEvenniaTest):
|
||||||
self.prot3["prototype_tags"] = [("foo1", _PROTOTYPE_TAG_META_CATEGORY)]
|
self.prot3["prototype_tags"] = [("foo1", _PROTOTYPE_TAG_META_CATEGORY)]
|
||||||
|
|
||||||
def test_prototype_storage(self):
|
def test_prototype_storage(self):
|
||||||
|
|
||||||
# from evennia import set_trace;set_trace(term_size=(180, 50))
|
# from evennia import set_trace;set_trace(term_size=(180, 50))
|
||||||
prot1 = protlib.create_prototype(self.prot1)
|
prot1 = protlib.create_prototype(self.prot1)
|
||||||
|
|
||||||
|
|
@ -500,7 +499,6 @@ class _MockMenu(object):
|
||||||
|
|
||||||
|
|
||||||
class TestMenuModule(BaseEvenniaTest):
|
class TestMenuModule(BaseEvenniaTest):
|
||||||
|
|
||||||
maxDiff = None
|
maxDiff = None
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
@ -518,7 +516,6 @@ class TestMenuModule(BaseEvenniaTest):
|
||||||
}
|
}
|
||||||
|
|
||||||
def test_helpers(self):
|
def test_helpers(self):
|
||||||
|
|
||||||
caller = self.caller
|
caller = self.caller
|
||||||
|
|
||||||
# general helpers
|
# general helpers
|
||||||
|
|
@ -579,7 +576,6 @@ class TestMenuModule(BaseEvenniaTest):
|
||||||
self.assertEqual(olc_menus._default_parse("f5", choices, *actions), (None, None))
|
self.assertEqual(olc_menus._default_parse("f5", choices, *actions), (None, None))
|
||||||
|
|
||||||
def test_node_helpers(self):
|
def test_node_helpers(self):
|
||||||
|
|
||||||
caller = self.caller
|
caller = self.caller
|
||||||
|
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
|
|
@ -820,7 +816,6 @@ class TestMenuModule(BaseEvenniaTest):
|
||||||
new=mock.MagicMock(return_value={"TypeclassTest": None}),
|
new=mock.MagicMock(return_value={"TypeclassTest": None}),
|
||||||
)
|
)
|
||||||
class TestOLCMenu(TestEvMenu):
|
class TestOLCMenu(TestEvMenu):
|
||||||
|
|
||||||
maxDiff = None
|
maxDiff = None
|
||||||
menutree = "evennia.prototypes.menus"
|
menutree = "evennia.prototypes.menus"
|
||||||
startnode = "node_index"
|
startnode = "node_index"
|
||||||
|
|
@ -941,7 +936,6 @@ class TestOLCMenu(TestEvMenu):
|
||||||
|
|
||||||
|
|
||||||
class PrototypeCrashTest(BaseEvenniaTest):
|
class PrototypeCrashTest(BaseEvenniaTest):
|
||||||
|
|
||||||
# increase this to 1000 for optimization testing
|
# increase this to 1000 for optimization testing
|
||||||
num_prototypes = 10
|
num_prototypes = 10
|
||||||
|
|
||||||
|
|
@ -1038,7 +1032,6 @@ class TestIssue2908(BaseEvenniaTest):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def test_spawn_with_protfunc(self):
|
def test_spawn_with_protfunc(self):
|
||||||
|
|
||||||
self.room1.tags.add("beach", category="zone")
|
self.room1.tags.add("beach", category="zone")
|
||||||
|
|
||||||
prot = {
|
prot = {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ The custom manager for Scripts.
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from evennia.server import signals
|
from evennia.server import signals
|
||||||
from evennia.typeclasses.managers import TypeclassManager, TypedObjectManager
|
from evennia.typeclasses.managers import TypeclassManager, TypedObjectManager
|
||||||
from evennia.utils.utils import class_from_module, dbid_to_obj, make_iter
|
from evennia.utils.utils import class_from_module, dbid_to_obj, make_iter
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class MonitorHandler(object):
|
||||||
restored_monitors = ServerConfig.objects.conf(key=self.savekey)
|
restored_monitors = ServerConfig.objects.conf(key=self.savekey)
|
||||||
if restored_monitors:
|
if restored_monitors:
|
||||||
restored_monitors = dbunserialize(restored_monitors)
|
restored_monitors = dbunserialize(restored_monitors)
|
||||||
for (obj, fieldname, idstring, path, persistent, kwargs) in restored_monitors:
|
for obj, fieldname, idstring, path, persistent, kwargs in restored_monitors:
|
||||||
try:
|
try:
|
||||||
if not server_reload and not persistent:
|
if not server_reload and not persistent:
|
||||||
# this monitor will not be restarted
|
# this monitor will not be restarted
|
||||||
|
|
@ -120,7 +120,7 @@ class MonitorHandler(object):
|
||||||
to_delete.append((obj, fieldname, idstring))
|
to_delete.append((obj, fieldname, idstring))
|
||||||
logger.log_trace("Monitor callback was removed.")
|
logger.log_trace("Monitor callback was removed.")
|
||||||
# we cleanup non-found monitors (has to be done after loop)
|
# we cleanup non-found monitors (has to be done after loop)
|
||||||
for (obj, fieldname, idstring) in to_delete:
|
for obj, fieldname, idstring in to_delete:
|
||||||
del self.monitors[obj][fieldname][idstring]
|
del self.monitors[obj][fieldname][idstring]
|
||||||
|
|
||||||
def add(self, obj, fieldname, callback, idstring="", persistent=False, category=None, **kwargs):
|
def add(self, obj, fieldname, callback, idstring="", persistent=False, category=None, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ added to all game objects. You access it through the property
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from evennia.scripts.models import ScriptDB
|
from evennia.scripts.models import ScriptDB
|
||||||
from evennia.utils import create, logger
|
from evennia.utils import create, logger
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,13 @@ ability to run timers.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
from twisted.internet.defer import Deferred, maybeDeferred
|
||||||
|
from twisted.internet.task import LoopingCall
|
||||||
|
|
||||||
from evennia.scripts.manager import ScriptManager
|
from evennia.scripts.manager import ScriptManager
|
||||||
from evennia.scripts.models import ScriptDB
|
from evennia.scripts.models import ScriptDB
|
||||||
from evennia.typeclasses.models import TypeclassBase
|
from evennia.typeclasses.models import TypeclassBase
|
||||||
from evennia.utils import create, logger
|
from evennia.utils import create, logger
|
||||||
from twisted.internet.defer import Deferred, maybeDeferred
|
|
||||||
from twisted.internet.task import LoopingCall
|
|
||||||
|
|
||||||
__all__ = ["DefaultScript", "DoNothing", "Store"]
|
__all__ = ["DefaultScript", "DoNothing", "Store"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ Unit tests for the scripts package
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from unittest import TestCase, mock
|
from unittest import TestCase, mock
|
||||||
|
|
||||||
|
from parameterized import parameterized
|
||||||
|
|
||||||
from evennia import DefaultScript
|
from evennia import DefaultScript
|
||||||
from evennia.objects.objects import DefaultObject
|
from evennia.objects.objects import DefaultObject
|
||||||
from evennia.scripts.manager import ScriptDBManager
|
from evennia.scripts.manager import ScriptDBManager
|
||||||
|
|
@ -16,7 +18,6 @@ from evennia.scripts.tickerhandler import TickerHandler
|
||||||
from evennia.utils.create import create_script
|
from evennia.utils.create import create_script
|
||||||
from evennia.utils.dbserialize import dbserialize
|
from evennia.utils.dbserialize import dbserialize
|
||||||
from evennia.utils.test_resources import BaseEvenniaTest
|
from evennia.utils.test_resources import BaseEvenniaTest
|
||||||
from parameterized import parameterized
|
|
||||||
|
|
||||||
|
|
||||||
class TestScript(BaseEvenniaTest):
|
class TestScript(BaseEvenniaTest):
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,6 @@ def node_game_index_start(wizard, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def node_game_index_fields(wizard, status=None):
|
def node_game_index_fields(wizard, status=None):
|
||||||
|
|
||||||
# reset the listing if needed
|
# reset the listing if needed
|
||||||
if not hasattr(wizard, "game_index_listing"):
|
if not hasattr(wizard, "game_index_listing"):
|
||||||
wizard.game_index_listing = settings.GAME_INDEX_LISTING
|
wizard.game_index_listing = settings.GAME_INDEX_LISTING
|
||||||
|
|
@ -420,7 +419,6 @@ def node_game_index_fields(wizard, status=None):
|
||||||
|
|
||||||
|
|
||||||
def node_mssp_start(wizard):
|
def node_mssp_start(wizard):
|
||||||
|
|
||||||
mssp_module = mod_import(settings.MSSP_META_MODULE or "server.conf.mssp")
|
mssp_module = mod_import(settings.MSSP_META_MODULE or "server.conf.mssp")
|
||||||
try:
|
try:
|
||||||
filename = mssp_module.__file__
|
filename = mssp_module.__file__
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,7 @@ import urllib.parse
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
import django
|
import django
|
||||||
import evennia
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia.accounts.models import AccountDB
|
|
||||||
from evennia.utils import get_evennia_version, logger
|
|
||||||
from twisted.internet import defer, protocol, reactor
|
from twisted.internet import defer, protocol, reactor
|
||||||
from twisted.internet.defer import inlineCallbacks
|
from twisted.internet.defer import inlineCallbacks
|
||||||
from twisted.web.client import Agent, HTTPConnectionPool, _HTTP11ClientFactory
|
from twisted.web.client import Agent, HTTPConnectionPool, _HTTP11ClientFactory
|
||||||
|
|
@ -19,6 +16,10 @@ from twisted.web.http_headers import Headers
|
||||||
from twisted.web.iweb import IBodyProducer
|
from twisted.web.iweb import IBodyProducer
|
||||||
from zope.interface import implementer
|
from zope.interface import implementer
|
||||||
|
|
||||||
|
import evennia
|
||||||
|
from evennia.accounts.models import AccountDB
|
||||||
|
from evennia.utils import get_evennia_version, logger
|
||||||
|
|
||||||
_EGI_HOST = "http://evennia-game-index.appspot.com"
|
_EGI_HOST = "http://evennia-game-index.appspot.com"
|
||||||
_EGI_REPORT_PATH = "/api/v1/game/check_in"
|
_EGI_REPORT_PATH = "/api/v1/game/check_in"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -353,9 +353,9 @@ class DiscordClient(WebSocketClientProtocol, _BASE_SESSION_CLASS):
|
||||||
url = f"{DISCORD_API_BASE_URL}/{url}"
|
url = f"{DISCORD_API_BASE_URL}/{url}"
|
||||||
body = FileBodyProducer(BytesIO(json.dumps(data).encode("utf-8")))
|
body = FileBodyProducer(BytesIO(json.dumps(data).encode("utf-8")))
|
||||||
request_type = kwargs.pop("type", "POST")
|
request_type = kwargs.pop("type", "POST")
|
||||||
|
|
||||||
d = _AGENT.request(
|
d = _AGENT.request(
|
||||||
request_type.encode("utf-8"),
|
request_type.encode("utf-8"),
|
||||||
url.encode("utf-8"),
|
url.encode("utf-8"),
|
||||||
Headers(
|
Headers(
|
||||||
{
|
{
|
||||||
|
|
@ -501,7 +501,6 @@ class DiscordClient(WebSocketClientProtocol, _BASE_SESSION_CLASS):
|
||||||
self._post_json(f"guilds/{guild_id}/members/{user_id}", data, type="PATCH")
|
self._post_json(f"guilds/{guild_id}/members/{user_id}", data, type="PATCH")
|
||||||
|
|
||||||
def send_role(self, role_id, guild_id, user_id, **kwargs):
|
def send_role(self, role_id, guild_id, user_id, **kwargs):
|
||||||
|
|
||||||
data = kwargs
|
data = kwargs
|
||||||
self._post_json(f"guilds/{guild_id}/members/{user_id}/roles/{role_id}", data, type="PUT")
|
self._post_json(f"guilds/{guild_id}/members/{user_id}/roles/{role_id}", data, type="PUT")
|
||||||
|
|
||||||
|
|
@ -570,4 +569,4 @@ class DiscordClient(WebSocketClientProtocol, _BASE_SESSION_CLASS):
|
||||||
# send the data for any other action types on to the bot as-is for optional server-side handling
|
# send the data for any other action types on to the bot as-is for optional server-side handling
|
||||||
keywords = {"type": action_type}
|
keywords = {"type": action_type}
|
||||||
keywords.update(data["d"])
|
keywords.update(data["d"])
|
||||||
self.sessionhandler.data_in(self, bot_data_in=("", keywords))
|
self.sessionhandler.data_in(self, bot_data_in=("", keywords))
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ class RestartingWebsocketServerFactory(WebSocketClientFactory, protocol.Reconnec
|
||||||
maxDelay = 60
|
maxDelay = 60
|
||||||
|
|
||||||
def __init__(self, sessionhandler, *args, **kwargs):
|
def __init__(self, sessionhandler, *args, **kwargs):
|
||||||
|
|
||||||
self.uid = kwargs.pop("uid")
|
self.uid = kwargs.pop("uid")
|
||||||
self.channel = kwargs.pop("grapevine_channel")
|
self.channel = kwargs.pop("grapevine_channel")
|
||||||
self.sessionhandler = sessionhandler
|
self.sessionhandler = sessionhandler
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import evennia
|
||||||
|
|
||||||
evennia._init(portal_mode=True)
|
evennia._init(portal_mode=True)
|
||||||
from evennia.server.portal.portalsessionhandler import PORTAL_SESSIONS
|
from evennia.server.portal.portalsessionhandler import PORTAL_SESSIONS
|
||||||
|
|
||||||
from evennia.server.webserver import EvenniaReverseProxyResource
|
from evennia.server.webserver import EvenniaReverseProxyResource
|
||||||
from evennia.utils import logger
|
from evennia.utils import logger
|
||||||
from evennia.utils.utils import (
|
from evennia.utils.utils import (
|
||||||
|
|
@ -264,11 +263,9 @@ if "--nodaemon" not in sys.argv and "test" not in sys.argv:
|
||||||
PORTAL = Portal(application)
|
PORTAL = Portal(application)
|
||||||
|
|
||||||
if LOCKDOWN_MODE:
|
if LOCKDOWN_MODE:
|
||||||
|
|
||||||
INFO_DICT["lockdown_mode"] = " LOCKDOWN_MODE active: Only local connections."
|
INFO_DICT["lockdown_mode"] = " LOCKDOWN_MODE active: Only local connections."
|
||||||
|
|
||||||
if AMP_ENABLED:
|
if AMP_ENABLED:
|
||||||
|
|
||||||
# The AMP protocol handles the communication between
|
# The AMP protocol handles the communication between
|
||||||
# the portal and the mud server. Only reason to ever deactivate
|
# the portal and the mud server. Only reason to ever deactivate
|
||||||
# it would be during testing and debugging.
|
# it would be during testing and debugging.
|
||||||
|
|
@ -287,7 +284,6 @@ if AMP_ENABLED:
|
||||||
# These will gradually be started as they are initialized below.
|
# These will gradually be started as they are initialized below.
|
||||||
|
|
||||||
if TELNET_ENABLED:
|
if TELNET_ENABLED:
|
||||||
|
|
||||||
# Start telnet game connections
|
# Start telnet game connections
|
||||||
|
|
||||||
from evennia.server.portal import telnet
|
from evennia.server.portal import telnet
|
||||||
|
|
@ -312,7 +308,6 @@ if TELNET_ENABLED:
|
||||||
|
|
||||||
|
|
||||||
if SSL_ENABLED:
|
if SSL_ENABLED:
|
||||||
|
|
||||||
# Start Telnet+SSL game connection (requires PyOpenSSL).
|
# Start Telnet+SSL game connection (requires PyOpenSSL).
|
||||||
|
|
||||||
from evennia.server.portal import telnet_ssl
|
from evennia.server.portal import telnet_ssl
|
||||||
|
|
@ -346,7 +341,6 @@ if SSL_ENABLED:
|
||||||
|
|
||||||
|
|
||||||
if SSH_ENABLED:
|
if SSH_ENABLED:
|
||||||
|
|
||||||
# Start SSH game connections. Will create a keypair in
|
# Start SSH game connections. Will create a keypair in
|
||||||
# evennia/game if necessary.
|
# evennia/game if necessary.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,6 @@ class SshProtocol(Manhole, _BASE_SESSION_CLASS):
|
||||||
|
|
||||||
|
|
||||||
class ExtraInfoAuthServer(SSHUserAuthServer):
|
class ExtraInfoAuthServer(SSHUserAuthServer):
|
||||||
|
|
||||||
noisy = False
|
noisy = False
|
||||||
|
|
||||||
def auth_password(self, packet):
|
def auth_password(self, packet):
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,6 @@ sessions etc.
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia.server.portal import mssp, naws, suppress_ga, telnet_oob, ttype
|
|
||||||
from evennia.server.portal.mccp import MCCP, Mccp, mccp_compress
|
|
||||||
from evennia.server.portal.mxp import Mxp, mxp_parse
|
|
||||||
from evennia.utils import ansi
|
|
||||||
from evennia.utils.utils import class_from_module, to_bytes
|
|
||||||
from twisted.conch.telnet import (
|
from twisted.conch.telnet import (
|
||||||
ECHO,
|
ECHO,
|
||||||
GA,
|
GA,
|
||||||
|
|
@ -33,6 +28,12 @@ from twisted.conch.telnet import (
|
||||||
from twisted.internet import protocol
|
from twisted.internet import protocol
|
||||||
from twisted.internet.task import LoopingCall
|
from twisted.internet.task import LoopingCall
|
||||||
|
|
||||||
|
from evennia.server.portal import mssp, naws, suppress_ga, telnet_oob, ttype
|
||||||
|
from evennia.server.portal.mccp import MCCP, Mccp, mccp_compress
|
||||||
|
from evennia.server.portal.mxp import Mxp, mxp_parse
|
||||||
|
from evennia.utils import ansi
|
||||||
|
from evennia.utils.utils import class_from_module, to_bytes
|
||||||
|
|
||||||
_RE_N = re.compile(r"\|n$")
|
_RE_N = re.compile(r"\|n$")
|
||||||
_RE_LEND = re.compile(rb"\n$|\r$|\r\n$|\r\x00$|", re.MULTILINE)
|
_RE_LEND = re.compile(rb"\n$|\r$|\r\n$|\r\x00$|", re.MULTILINE)
|
||||||
_RE_LINEBREAK = re.compile(rb"\n\r|\r\n|\n|\r", re.DOTALL + re.MULTILINE)
|
_RE_LINEBREAK = re.compile(rb"\n\r|\r\n|\n|\r", re.DOTALL + re.MULTILINE)
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,6 @@ def verify_or_create_SSL_key_and_cert(keyfile, certfile):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# create certificate
|
# create certificate
|
||||||
cert = crypto.X509()
|
cert = crypto.X509()
|
||||||
|
|
|
||||||
|
|
@ -600,7 +600,6 @@ def start_all_dummy_clients(nclients):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
try:
|
try:
|
||||||
settings.DUMMYRUNNER_MIXIN
|
settings.DUMMYRUNNER_MIXIN
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@ class Memplot(evennia.DefaultScript):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
# plot output from the file
|
# plot output from the file
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ def count_queries(exec_string, setup_string):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
# setup tests here
|
# setup tests here
|
||||||
|
|
||||||
setup_string = """
|
setup_string = """
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ from django.conf import settings
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.db.utils import OperationalError
|
from django.db.utils import OperationalError
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from evennia.accounts.models import AccountDB
|
from evennia.accounts.models import AccountDB
|
||||||
from evennia.scripts.models import ScriptDB
|
from evennia.scripts.models import ScriptDB
|
||||||
from evennia.server.models import ServerConfig
|
from evennia.server.models import ServerConfig
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,15 @@ import time
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from evennia.commands.cmdsethandler import CmdSetHandler
|
from evennia.commands.cmdsethandler import CmdSetHandler
|
||||||
from evennia.comms.models import ChannelDB
|
from evennia.comms.models import ChannelDB
|
||||||
from evennia.scripts.monitorhandler import MONITOR_HANDLER
|
from evennia.scripts.monitorhandler import MONITOR_HANDLER
|
||||||
from evennia.typeclasses.attributes import AttributeHandler, DbHolder, InMemoryAttributeBackend
|
from evennia.typeclasses.attributes import (
|
||||||
|
AttributeHandler,
|
||||||
|
DbHolder,
|
||||||
|
InMemoryAttributeBackend,
|
||||||
|
)
|
||||||
from evennia.utils import logger
|
from evennia.utils import logger
|
||||||
from evennia.utils.utils import class_from_module, lazy_property, make_iter
|
from evennia.utils.utils import class_from_module, lazy_property, make_iter
|
||||||
|
|
||||||
|
|
@ -444,4 +449,3 @@ class ServerSession(_BASE_SESSION_CLASS):
|
||||||
return self.account.get_display_name(*args, **kwargs)
|
return self.account.get_display_name(*args, **kwargs)
|
||||||
else:
|
else:
|
||||||
return f"{self.protocol_key}({self.address})"
|
return f"{self.protocol_key}({self.address})"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,9 +95,9 @@ SIGNAL_EXIT_TRAVERSED = Signal()
|
||||||
|
|
||||||
from django.core.signals import request_finished # " ends.
|
from django.core.signals import request_finished # " ends.
|
||||||
from django.core.signals import request_started # Sent when HTTP request begins.
|
from django.core.signals import request_started # Sent when HTTP request begins.
|
||||||
from django.db.backends.signals import (
|
from django.db.backends.signals import ( # Sent when making initial connection to database
|
||||||
connection_created,
|
connection_created,
|
||||||
) # Sent when making initial connection to database
|
)
|
||||||
from django.db.models.signals import m2m_changed # Sent when a ManyToManyField changes.
|
from django.db.models.signals import m2m_changed # Sent when a ManyToManyField changes.
|
||||||
from django.db.models.signals import post_delete # after "
|
from django.db.models.signals import post_delete # after "
|
||||||
from django.db.models.signals import post_init # end
|
from django.db.models.signals import post_init # end
|
||||||
|
|
@ -105,9 +105,15 @@ from django.db.models.signals import post_migrate # after "
|
||||||
from django.db.models.signals import post_save # after "
|
from django.db.models.signals import post_save # after "
|
||||||
from django.db.models.signals import pre_delete # Sent before an object is deleted.
|
from django.db.models.signals import pre_delete # Sent before an object is deleted.
|
||||||
from django.db.models.signals import pre_migrate # Sent before migration starts
|
from django.db.models.signals import pre_migrate # Sent before migration starts
|
||||||
from django.db.models.signals import pre_save # Sent before a typeclass' .save is called.
|
|
||||||
from django.db.models.signals import (
|
from django.db.models.signals import (
|
||||||
|
pre_save, # Sent before a typeclass' .save is called.
|
||||||
|
)
|
||||||
|
from django.db.models.signals import ( # Sent at start of typeclass __init__ (before at_init)
|
||||||
pre_init,
|
pre_init,
|
||||||
) # Sent at start of typeclass __init__ (before at_init)
|
)
|
||||||
from django.test.signals import setting_changed # Sent when setting changes from override
|
from django.test.signals import (
|
||||||
from django.test.signals import template_rendered # Sent when test system renders template
|
setting_changed, # Sent when setting changes from override
|
||||||
|
)
|
||||||
|
from django.test.signals import (
|
||||||
|
template_rendered, # Sent when test system renders template
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ from evennia.utils import create
|
||||||
|
|
||||||
DelayedCall.debug = True
|
DelayedCall.debug = True
|
||||||
|
|
||||||
|
|
||||||
# @patch("evennia.server.initial_setup.get_god_account",
|
# @patch("evennia.server.initial_setup.get_god_account",
|
||||||
# MagicMock(return_value=create.account("TestAMPAccount", "test@test.com", "testpassword")))
|
# MagicMock(return_value=create.account("TestAMPAccount", "test@test.com", "testpassword")))
|
||||||
class _TestAMP(TwistedTestCase):
|
class _TestAMP(TwistedTestCase):
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,6 @@ class TestServer(TestCase):
|
||||||
|
|
||||||
def test_evennia_start(self):
|
def test_evennia_start(self):
|
||||||
with patch.multiple("evennia.server.server", time=DEFAULT, service=DEFAULT) as mocks:
|
with patch.multiple("evennia.server.server", time=DEFAULT, service=DEFAULT) as mocks:
|
||||||
|
|
||||||
mocks["time"].time = MagicMock(return_value=1000)
|
mocks["time"].time = MagicMock(return_value=1000)
|
||||||
evennia = self.server.Evennia(MagicMock())
|
evennia = self.server.Evennia(MagicMock())
|
||||||
self.assertEqual(evennia.start_time, 1000)
|
self.assertEqual(evennia.start_time, 1000)
|
||||||
|
|
@ -127,7 +126,6 @@ class TestServer(TestCase):
|
||||||
@patch("evennia.comms.models.ChannelDB")
|
@patch("evennia.comms.models.ChannelDB")
|
||||||
def test_update_defaults(self, mockchan, mockscript, mockacct, mockobj):
|
def test_update_defaults(self, mockchan, mockscript, mockacct, mockobj):
|
||||||
with patch.multiple("evennia.server.server", ServerConfig=DEFAULT) as mocks:
|
with patch.multiple("evennia.server.server", ServerConfig=DEFAULT) as mocks:
|
||||||
|
|
||||||
mockchan.objects.filter = MagicMock()
|
mockchan.objects.filter = MagicMock()
|
||||||
mockscript.objects.filter = MagicMock()
|
mockscript.objects.filter = MagicMock()
|
||||||
mockacct.objects.filter = MagicMock()
|
mockacct.objects.filter = MagicMock()
|
||||||
|
|
@ -199,7 +197,6 @@ class TestServer(TestCase):
|
||||||
|
|
||||||
class TestInitHooks(TestCase):
|
class TestInitHooks(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
||||||
from evennia.server import server
|
from evennia.server import server
|
||||||
from evennia.utils import create
|
from evennia.utils import create
|
||||||
|
|
||||||
|
|
@ -235,7 +232,6 @@ class TestInitHooks(TestCase):
|
||||||
|
|
||||||
@override_settings(_TEST_ENVIRONMENT=True)
|
@override_settings(_TEST_ENVIRONMENT=True)
|
||||||
def test_run_init_hooks(self):
|
def test_run_init_hooks(self):
|
||||||
|
|
||||||
evennia = self.server.Evennia(MagicMock())
|
evennia = self.server.Evennia(MagicMock())
|
||||||
|
|
||||||
evennia.at_server_reload_start = MagicMock()
|
evennia.at_server_reload_start = MagicMock()
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ class EvenniaTestSuiteRunner(DiscoverRunner):
|
||||||
super().setup_test_environment(**kwargs)
|
super().setup_test_environment(**kwargs)
|
||||||
|
|
||||||
def teardown_test_environment(self, **kwargs):
|
def teardown_test_environment(self, **kwargs):
|
||||||
|
|
||||||
# remove testing flag after suite has run
|
# remove testing flag after suite has run
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import re
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from evennia.accounts.models import AccountDB
|
from evennia.accounts.models import AccountDB
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1036,17 +1036,17 @@ MIDDLEWARE = [
|
||||||
# A list of Django apps (see INSTALLED_APPS) that will be listed first (if present)
|
# A list of Django apps (see INSTALLED_APPS) that will be listed first (if present)
|
||||||
# in the Django web Admin page.
|
# in the Django web Admin page.
|
||||||
DJANGO_ADMIN_APP_ORDER = [
|
DJANGO_ADMIN_APP_ORDER = [
|
||||||
"accounts",
|
"accounts",
|
||||||
"objects",
|
"objects",
|
||||||
"scripts",
|
"scripts",
|
||||||
"comms",
|
"comms",
|
||||||
"help",
|
"help",
|
||||||
"typeclasses",
|
"typeclasses",
|
||||||
"server",
|
"server",
|
||||||
"sites",
|
"sites",
|
||||||
"flatpages",
|
"flatpages",
|
||||||
"auth",
|
"auth",
|
||||||
]
|
]
|
||||||
|
|
||||||
# The following apps will be excluded from the Django web Admin page.
|
# The following apps will be excluded from the Django web Admin page.
|
||||||
DJANGO_ADMIN_APP_EXCLUDE = list()
|
DJANGO_ADMIN_APP_EXCLUDE = list()
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ from collections import defaultdict
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.encoding import smart_str
|
from django.utils.encoding import smart_str
|
||||||
|
|
||||||
from evennia.locks.lockhandler import LockHandler
|
from evennia.locks.lockhandler import LockHandler
|
||||||
from evennia.utils.dbserialize import from_pickle, to_pickle
|
from evennia.utils.dbserialize import from_pickle, to_pickle
|
||||||
from evennia.utils.idmapper.models import SharedMemoryModel
|
from evennia.utils.idmapper.models import SharedMemoryModel
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue