Apply black to codes
This commit is contained in:
parent
870c0f5f75
commit
c5a4a34bac
180 changed files with 495 additions and 288 deletions
|
|
@ -221,7 +221,6 @@ def get_available_overwrite_name(name, max_length):
|
|||
|
||||
@deconstructible
|
||||
class S3Boto3StorageFile(File):
|
||||
|
||||
"""
|
||||
The default file object used by the S3Boto3Storage backend.
|
||||
This file implements file streaming using boto's multipart
|
||||
|
|
|
|||
|
|
@ -2,5 +2,6 @@
|
|||
Build-menu contrib - vincent-lg 2018
|
||||
|
||||
"""
|
||||
|
||||
from .building_menu import BuildingMenu # noqa
|
||||
from .building_menu import GenericBuildingCmd # noqa
|
||||
|
|
|
|||
|
|
@ -331,7 +331,6 @@ def menu_edit(caller, choice, obj):
|
|||
|
||||
|
||||
class CmdNoInput(Command):
|
||||
|
||||
"""No input has been found."""
|
||||
|
||||
key = _CMD_NOINPUT
|
||||
|
|
@ -352,7 +351,6 @@ class CmdNoInput(Command):
|
|||
|
||||
|
||||
class CmdNoMatch(Command):
|
||||
|
||||
"""No input has been found."""
|
||||
|
||||
key = _CMD_NOMATCH
|
||||
|
|
@ -394,7 +392,6 @@ class CmdNoMatch(Command):
|
|||
|
||||
|
||||
class BuildingMenuCmdSet(CmdSet):
|
||||
|
||||
"""Building menu CmdSet."""
|
||||
|
||||
key = "building_menu"
|
||||
|
|
@ -421,7 +418,6 @@ class BuildingMenuCmdSet(CmdSet):
|
|||
|
||||
|
||||
class Choice:
|
||||
|
||||
"""A choice object, created by `add_choice`."""
|
||||
|
||||
def __init__(
|
||||
|
|
@ -557,7 +553,6 @@ class Choice:
|
|||
|
||||
|
||||
class BuildingMenu:
|
||||
|
||||
"""
|
||||
Class allowing to create and set building menus to edit specific objects.
|
||||
|
||||
|
|
@ -1200,7 +1195,6 @@ class BuildingMenu:
|
|||
|
||||
# Generic building menu and command
|
||||
class GenericBuildingMenu(BuildingMenu):
|
||||
|
||||
"""A generic building menu, allowing to edit any object.
|
||||
|
||||
This is more a demonstration menu. By default, it allows to edit the
|
||||
|
|
@ -1241,7 +1235,6 @@ class GenericBuildingMenu(BuildingMenu):
|
|||
|
||||
|
||||
class GenericBuildingCmd(Command):
|
||||
|
||||
"""
|
||||
Generic building command.
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ This helps writing isolated code and reusing it over multiple objects.
|
|||
|
||||
See the docs for more information.
|
||||
"""
|
||||
|
||||
from . import exceptions # noqa
|
||||
from .component import Component # noqa
|
||||
from .dbfield import DBField, NDBField, TagField # noqa
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ Components - ChrisLR 2022
|
|||
|
||||
This file contains the Descriptors used to set Fields in Components
|
||||
"""
|
||||
|
||||
import typing
|
||||
|
||||
from evennia.typeclasses.attributes import AttributeProperty, NAttributeProperty
|
||||
|
|
|
|||
|
|
@ -309,7 +309,6 @@ def schedule(callback, repeat=False, **kwargs):
|
|||
|
||||
|
||||
class GametimeScript(DefaultScript):
|
||||
|
||||
"""Gametime-sensitive script."""
|
||||
|
||||
def at_script_creation(self):
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ You could also pass extra data to this client for advanced functionality.
|
|||
|
||||
See the docs for more information.
|
||||
"""
|
||||
|
||||
from evennia.contrib.base_systems.godotwebsocket.text2bbcode import (
|
||||
BBCODE_PARSER,
|
||||
parse_to_bbcode,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ Godot Websocket - ChrisLR 2022
|
|||
|
||||
This file contains the necessary code and data to convert text with color tags to bbcode (For godot)
|
||||
"""
|
||||
|
||||
from evennia.utils.ansi import *
|
||||
from evennia.utils.text2html import TextToHTMLparser
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ Godot Websocket - ChrisLR 2022
|
|||
This file contains the code necessary to dedicate a port to communicate with Godot via Websockets.
|
||||
It uses the plugin system and should be plugged via settings as detailed in the readme.
|
||||
"""
|
||||
|
||||
import json
|
||||
|
||||
from autobahn.twisted import WebSocketServerFactory
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ from collections import namedtuple
|
|||
|
||||
|
||||
class CallbackHandler(object):
|
||||
|
||||
"""
|
||||
The callback handler for a specific object.
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,6 @@ Use the /del switch to remove callbacks that should not be connected.
|
|||
|
||||
|
||||
class CmdCallback(COMMAND_DEFAULT_CLASS):
|
||||
|
||||
"""
|
||||
Command to edit callbacks.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ RE_LINE_ERROR = re.compile(r'^ File "\<string\>", line (\d+)')
|
|||
|
||||
|
||||
class EventHandler(DefaultScript):
|
||||
|
||||
"""
|
||||
The event handler that contains all events in a global script.
|
||||
|
||||
|
|
@ -600,7 +599,6 @@ class EventHandler(DefaultScript):
|
|||
|
||||
# Script to call time-related events
|
||||
class TimeEventScript(DefaultScript):
|
||||
|
||||
"""Gametime-sensitive script."""
|
||||
|
||||
def at_script_creation(self):
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ OLD_EVENTS = {}
|
|||
|
||||
|
||||
class TestEventHandler(BaseEvenniaTest):
|
||||
|
||||
"""
|
||||
Test cases of the event handler to add, edit or delete events.
|
||||
"""
|
||||
|
|
@ -259,7 +258,6 @@ class TestEventHandler(BaseEvenniaTest):
|
|||
|
||||
|
||||
class TestCmdCallback(BaseEvenniaCommandTest):
|
||||
|
||||
"""Test the @callback command."""
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -448,7 +446,6 @@ class TestCmdCallback(BaseEvenniaCommandTest):
|
|||
|
||||
|
||||
class TestDefaultCallbacks(BaseEvenniaCommandTest):
|
||||
|
||||
"""Test the default callbacks."""
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -166,7 +166,6 @@ Variables you can use in this event:
|
|||
|
||||
@register_events
|
||||
class EventCharacter(DefaultCharacter):
|
||||
|
||||
"""Typeclass to represent a character and call event types."""
|
||||
|
||||
_events = {
|
||||
|
|
@ -625,7 +624,6 @@ Variables you can use in this event:
|
|||
|
||||
@register_events
|
||||
class EventExit(DefaultExit):
|
||||
|
||||
"""Modified exit including management of events."""
|
||||
|
||||
_events = {
|
||||
|
|
@ -721,7 +719,6 @@ Variables you can use in this event:
|
|||
|
||||
@register_events
|
||||
class EventObject(DefaultObject):
|
||||
|
||||
"""Default object with management of events."""
|
||||
|
||||
_events = {
|
||||
|
|
@ -892,7 +889,6 @@ Variables you can use in this event:
|
|||
|
||||
@register_events
|
||||
class EventRoom(DefaultRoom):
|
||||
|
||||
"""Default room with management of events."""
|
||||
|
||||
_events = {
|
||||
|
|
|
|||
|
|
@ -251,7 +251,6 @@ def phrase_event(callbacks, parameters):
|
|||
|
||||
|
||||
class InterruptEvent(RuntimeError):
|
||||
|
||||
"""
|
||||
Interrupt the current event.
|
||||
|
||||
|
|
|
|||
|
|
@ -21,10 +21,14 @@ called automatically when a new user connects.
|
|||
"""
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from evennia import CmdSet, Command, syscmdkeys
|
||||
from evennia.utils.evmenu import EvMenu
|
||||
from evennia.utils.utils import (callables_from_module, class_from_module,
|
||||
random_string_from_module)
|
||||
from evennia.utils.utils import (
|
||||
callables_from_module,
|
||||
class_from_module,
|
||||
random_string_from_module,
|
||||
)
|
||||
|
||||
_CONNECTION_SCREEN_MODULE = settings.CONNECTION_SCREEN_MODULE
|
||||
_GUEST_ENABLED = settings.GUEST_ENABLED
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
|||
```
|
||||
|
||||
"""
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from evennia.commands.cmdset import CmdSet
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ from .unixcommand import UnixCommand
|
|||
|
||||
|
||||
class CmdDummy(UnixCommand):
|
||||
|
||||
"""A dummy UnixCommand."""
|
||||
|
||||
key = "dummy"
|
||||
|
|
|
|||
|
|
@ -72,14 +72,12 @@ from evennia.utils.ansi import raw
|
|||
|
||||
|
||||
class ParseError(Exception):
|
||||
|
||||
"""An error occurred during parsing."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class UnixCommandParser(argparse.ArgumentParser):
|
||||
|
||||
"""A modifier command parser for unix commands.
|
||||
|
||||
This parser is used to replace `argparse.ArgumentParser`. It
|
||||
|
|
@ -183,7 +181,6 @@ class UnixCommandParser(argparse.ArgumentParser):
|
|||
|
||||
|
||||
class HelpAction(argparse.Action):
|
||||
|
||||
"""Override the -h/--help action in the default parser.
|
||||
|
||||
Using the default -h/--help will call the exit function in different
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ Here player user can set their own description as well as select to create a
|
|||
new room (to start from scratch) or join an existing room (with other players).
|
||||
|
||||
"""
|
||||
|
||||
from evennia import EvMenu
|
||||
from evennia.utils import create, justify, list_to_string, logger
|
||||
from evennia.utils.evmenu import list_node
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ Available parents:
|
|||
- Positionable (supports sit/lie/knee/climb at once)
|
||||
|
||||
"""
|
||||
|
||||
import inspect
|
||||
import re
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
Unit tests for the Evscaperoom
|
||||
|
||||
"""
|
||||
|
||||
import inspect
|
||||
import pkgutil
|
||||
from os import path
|
||||
|
|
|
|||
|
|
@ -72,9 +72,11 @@ with which to test the system:
|
|||
wear shirt
|
||||
|
||||
"""
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from evennia import DefaultCharacter, DefaultObject, default_cmds
|
||||
from evennia.commands.default.muxcommand import MuxCommand
|
||||
from evennia.utils import (
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ or implement the same locks/hooks in your own typeclasses.
|
|||
at_pre_get_from(getter, target, **kwargs) - called with the pre-get hooks
|
||||
at_pre_put_in(putter, target, **kwargs) - called with the pre-put hooks
|
||||
"""
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from evennia import AttributeProperty, CmdSet, DefaultObject
|
||||
|
|
|
|||
|
|
@ -615,9 +615,11 @@ class CraftingRecipe(CraftingRecipeBase):
|
|||
)
|
||||
else:
|
||||
self.output_names = [
|
||||
prot.get("key", prot.get("typeclass", "unnamed"))
|
||||
if isinstance(prot, dict)
|
||||
else str(prot)
|
||||
(
|
||||
prot.get("key", prot.get("typeclass", "unnamed"))
|
||||
if isinstance(prot, dict)
|
||||
else str(prot)
|
||||
)
|
||||
for prot in self.output_prototypes
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ Test gendersub contrib.
|
|||
|
||||
"""
|
||||
|
||||
|
||||
from mock import patch
|
||||
|
||||
from evennia.commands.default.tests import BaseEvenniaCommandTest
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ Reload the server and you should have the +desc command available (it
|
|||
will replace the default `desc` command).
|
||||
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
from evennia import default_cmds
|
||||
|
|
|
|||
|
|
@ -47,8 +47,17 @@ from collections import deque
|
|||
|
||||
from django.conf import settings
|
||||
from django.db.models import Q
|
||||
from evennia import (CmdSet, DefaultRoom, EvEditor, FuncParser,
|
||||
InterruptCommand, default_cmds, gametime, utils)
|
||||
|
||||
from evennia import (
|
||||
CmdSet,
|
||||
DefaultRoom,
|
||||
EvEditor,
|
||||
FuncParser,
|
||||
InterruptCommand,
|
||||
default_cmds,
|
||||
gametime,
|
||||
utils,
|
||||
)
|
||||
from evennia.typeclasses.attributes import AttributeProperty
|
||||
from evennia.utils.utils import list_to_string, repeat
|
||||
|
||||
|
|
@ -814,7 +823,6 @@ class CmdExtendedRoomDesc(default_cmds.CmdDesc):
|
|||
|
||||
|
||||
class CmdExtendedRoomDetail(default_cmds.MuxCommand):
|
||||
|
||||
"""
|
||||
sets a detail on a room
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@ Testing of ExtendedRoom contrib
|
|||
import datetime
|
||||
|
||||
from django.conf import settings
|
||||
from evennia import create_object
|
||||
from evennia.utils.test_resources import BaseEvenniaCommandTest, EvenniaTestCase
|
||||
from mock import Mock, patch
|
||||
from parameterized import parameterized
|
||||
|
||||
from evennia import create_object
|
||||
from evennia.utils.test_resources import BaseEvenniaCommandTest, EvenniaTestCase
|
||||
|
||||
from . import extended_room
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ This changes the default map width/height. 2-5 for most clients is sensible.
|
|||
If you don't want the player to be able to specify the size of the map, ignore any
|
||||
arguments passed into the Map command.
|
||||
"""
|
||||
|
||||
import time
|
||||
|
||||
from django.conf import settings
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ Tests of ingame_map_display.
|
|||
|
||||
"""
|
||||
|
||||
|
||||
from typeclasses import exits, rooms
|
||||
|
||||
from evennia.commands.default.tests import BaseEvenniaCommandTest
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ Tests of simpledoor.
|
|||
|
||||
"""
|
||||
|
||||
|
||||
from evennia.commands.default.tests import BaseEvenniaCommandTest
|
||||
|
||||
from . import simpledoor
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
XYZGrid - Griatch 2021
|
||||
|
||||
"""
|
||||
|
||||
from . import (
|
||||
example,
|
||||
launchcmd,
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ and/or
|
|||
{'prototype_parent': 'xyz_exit', ...}
|
||||
|
||||
"""
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -3,14 +3,15 @@
|
|||
Tests for the XYZgrid system.
|
||||
|
||||
"""
|
||||
|
||||
from random import randint
|
||||
from unittest import mock
|
||||
|
||||
from django.test import TestCase
|
||||
from evennia.utils.test_resources import (BaseEvenniaCommandTest,
|
||||
BaseEvenniaTest)
|
||||
from parameterized import parameterized
|
||||
|
||||
from evennia.utils.test_resources import BaseEvenniaCommandTest, BaseEvenniaTest
|
||||
|
||||
from . import commands, xymap, xymap_legend, xyzgrid, xyzroom
|
||||
|
||||
MAP1 = """
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ See `./example.py` for a full grid example.
|
|||
|
||||
----
|
||||
"""
|
||||
|
||||
import pickle
|
||||
from collections import defaultdict
|
||||
from os import mkdir
|
||||
|
|
@ -108,6 +109,7 @@ except ImportError as err:
|
|||
"the SciPy package. Install with `pip install scipy'."
|
||||
)
|
||||
from django.conf import settings
|
||||
|
||||
from evennia.prototypes import prototypes as protlib
|
||||
from evennia.prototypes.spawner import flatten_prototype
|
||||
from evennia.utils import logger
|
||||
|
|
@ -172,6 +174,7 @@ class XYMap:
|
|||
but recommended for readability!
|
||||
|
||||
"""
|
||||
|
||||
mapcorner_symbol = "+"
|
||||
max_pathfinding_length = 500
|
||||
empty_symbol = " "
|
||||
|
|
@ -475,10 +478,10 @@ class XYMap:
|
|||
max_X, max_Y = max(max_X, iX), max(max_Y, iY)
|
||||
node_index += 1
|
||||
|
||||
xygrid[ix][iy] = XYgrid[iX][iY] = node_index_map[
|
||||
node_index
|
||||
] = mapnode_or_link_class(
|
||||
x=ix, y=iy, Z=self.Z, node_index=node_index, symbol=char, xymap=self
|
||||
xygrid[ix][iy] = XYgrid[iX][iY] = node_index_map[node_index] = (
|
||||
mapnode_or_link_class(
|
||||
x=ix, y=iy, Z=self.Z, node_index=node_index, symbol=char, xymap=self
|
||||
)
|
||||
)
|
||||
|
||||
else:
|
||||
|
|
@ -668,8 +671,7 @@ class XYMap:
|
|||
"""
|
||||
global _XYZROOMCLASS
|
||||
if not _XYZROOMCLASS:
|
||||
from evennia.contrib.grid.xyzgrid.xyzroom import \
|
||||
XYZRoom as _XYZROOMCLASS
|
||||
from evennia.contrib.grid.xyzgrid.xyzroom import XYZRoom as _XYZROOMCLASS
|
||||
x, y = xy
|
||||
wildcard = "*"
|
||||
spawned = []
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ import uuid
|
|||
from collections import defaultdict
|
||||
|
||||
from django.core import exceptions as django_exceptions
|
||||
|
||||
from evennia.prototypes import spawner
|
||||
from evennia.utils.utils import class_from_module
|
||||
|
||||
from .utils import (BIGVAL, MAPSCAN, REVERSE_DIRECTIONS, MapError,
|
||||
MapParserError)
|
||||
from .utils import BIGVAL, MAPSCAN, REVERSE_DIRECTIONS, MapError, MapParserError
|
||||
|
||||
NodeTypeclass = None
|
||||
ExitTypeclass = None
|
||||
|
|
@ -844,6 +844,7 @@ class SmartRerouterMapLink(MapLink):
|
|||
/|
|
||||
|
||||
"""
|
||||
|
||||
multilink = True
|
||||
|
||||
def get_direction(self, start_direction):
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ The grid has three main functions:
|
|||
|
||||
|
||||
"""
|
||||
|
||||
from evennia.scripts.scripts import DefaultScript
|
||||
from evennia.utils import logger
|
||||
from evennia.utils.utils import variable_from_module
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
from .buff import (BaseBuff, BuffableProperty, BuffHandler, CmdBuff, # noqa
|
||||
Mod, cleanup_buffs, tick_buff)
|
||||
from .samplebuffs import (Exploit, Exploited, Leeching, Poison, Sated, # noqa
|
||||
StatBuff)
|
||||
from .buff import CmdBuff # noqa
|
||||
from .buff import BaseBuff, BuffableProperty, BuffHandler, Mod, cleanup_buffs, tick_buff
|
||||
from .samplebuffs import Exploit, Exploited, Leeching, Poison, Sated, StatBuff # noqa
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ You can see all the features of the `BaseBuff` class below, or browse `samplebuf
|
|||
many attributes and hook methods you can overload to create complex, interrelated buffs.
|
||||
|
||||
"""
|
||||
|
||||
import time
|
||||
from random import random
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
"""
|
||||
Tests for the buff system contrib
|
||||
"""
|
||||
|
||||
from unittest.mock import Mock, call, patch
|
||||
|
||||
from evennia import DefaultObject, create_object
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ and examples, including how to allow players to choose and confirm
|
|||
character names from within the menu.
|
||||
|
||||
"""
|
||||
|
||||
import string
|
||||
from random import choices
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ of the roll separately:
|
|||
|
||||
|
||||
"""
|
||||
|
||||
import re
|
||||
from ast import literal_eval
|
||||
from random import randint
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ This allows to quickly build a large corpus of translated words
|
|||
that never change (if this is desired).
|
||||
|
||||
"""
|
||||
|
||||
import re
|
||||
from collections import defaultdict
|
||||
from random import choice, randint
|
||||
|
|
|
|||
|
|
@ -148,19 +148,25 @@ Extra Installation Instructions:
|
|||
`type/reset/force me = typeclasses.characters.Character`
|
||||
|
||||
"""
|
||||
|
||||
import re
|
||||
from collections import defaultdict
|
||||
from string import punctuation
|
||||
|
||||
import inflect
|
||||
from django.conf import settings
|
||||
|
||||
from evennia.commands.cmdset import CmdSet
|
||||
from evennia.commands.command import Command
|
||||
from evennia.objects.models import ObjectDB
|
||||
from evennia.objects.objects import DefaultCharacter, DefaultObject
|
||||
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()
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@
|
|||
Tests for RP system
|
||||
|
||||
"""
|
||||
|
||||
import time
|
||||
|
||||
from anything import Anything
|
||||
|
||||
from evennia import DefaultObject, create_object, default_cmds
|
||||
from evennia.commands.default import building
|
||||
from evennia.commands.default.tests import BaseEvenniaCommandTest
|
||||
|
|
@ -426,11 +428,11 @@ class TestRPSystemCommands(BaseEvenniaCommandTest):
|
|||
self.call(default_cmds.CmdLook(), "Mushroom-2", expected_third_call) # FAILS
|
||||
|
||||
expected_fourth_call = "Alias(es) for 'Mushroom' set to 'fungus'."
|
||||
self.call(building.CmdSetObjAlias(), "Mushroom-1 = fungus", expected_fourth_call) #PASSES
|
||||
self.call(building.CmdSetObjAlias(), "Mushroom-1 = fungus", expected_fourth_call) # PASSES
|
||||
|
||||
expected_fifth_call = [
|
||||
"More than one match for 'Mushroom' (please narrow target):",
|
||||
f" Mushroom-1 [fungus]",
|
||||
f" Mushroom-2",
|
||||
]
|
||||
self.call(default_cmds.CmdLook(), "Mushroom", "\n".join(expected_fifth_call)) # PASSES
|
||||
self.call(default_cmds.CmdLook(), "Mushroom", "\n".join(expected_fifth_call)) # PASSES
|
||||
|
|
|
|||
|
|
@ -452,7 +452,6 @@ class Character(DefaultCharacter):
|
|||
|
||||
"""
|
||||
|
||||
|
||||
from functools import total_ordering
|
||||
from time import time
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ The script will only send messages to the object it is stored on, so
|
|||
make sure to put it on yourself or you won't see any messages!
|
||||
|
||||
"""
|
||||
|
||||
import random
|
||||
|
||||
from evennia import DefaultScript
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
Tests for the bodyfunctions.
|
||||
|
||||
"""
|
||||
|
||||
from mock import Mock, patch
|
||||
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ class AIHandler:
|
|||
|
||||
def __init__(self, obj):
|
||||
self.obj = obj
|
||||
self.ai_state = obj.attributes.get(self.attribute_name,
|
||||
category=self.attribute_category,
|
||||
default="idle")
|
||||
self.ai_state = obj.attributes.get(
|
||||
self.attribute_name, category=self.attribute_category, default="idle"
|
||||
)
|
||||
|
||||
def set_state(self, state):
|
||||
self.ai_state = state
|
||||
|
|
@ -122,6 +122,7 @@ class AIMixin:
|
|||
of multiple inheritance. In a real game, you would probably want to use a mixin like this.
|
||||
|
||||
"""
|
||||
|
||||
@lazy_property
|
||||
def ai(self):
|
||||
return AIHandler(self)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
EvAdventure character generation.
|
||||
|
||||
"""
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from evennia.objects.models import ObjectDB
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ action that takes several vulnerable turns to complete.
|
|||
|
||||
"""
|
||||
|
||||
|
||||
import random
|
||||
from collections import defaultdict
|
||||
|
||||
|
|
@ -26,9 +25,15 @@ from evennia import AttributeProperty, CmdSet, Command, EvMenu
|
|||
from evennia.utils import inherits_from, list_to_string
|
||||
|
||||
from .characters import EvAdventureCharacter
|
||||
from .combat_base import (CombatAction, CombatActionAttack, CombatActionHold,
|
||||
CombatActionStunt, CombatActionUseItem,
|
||||
CombatActionWield, EvAdventureCombatBaseHandler)
|
||||
from .combat_base import (
|
||||
CombatAction,
|
||||
CombatActionAttack,
|
||||
CombatActionHold,
|
||||
CombatActionStunt,
|
||||
CombatActionUseItem,
|
||||
CombatActionWield,
|
||||
EvAdventureCombatBaseHandler,
|
||||
)
|
||||
from .enums import Ability
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,15 +6,27 @@ This implements a 'twitch' (aka DIKU or other traditional muds) style of MUD com
|
|||
----
|
||||
|
||||
"""
|
||||
|
||||
from evennia import AttributeProperty, CmdSet, default_cmds
|
||||
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 .combat_base import (CombatActionAttack, CombatActionHold,
|
||||
CombatActionStunt, CombatActionUseItem,
|
||||
CombatActionWield, EvAdventureCombatBaseHandler)
|
||||
from .combat_base import (
|
||||
CombatActionAttack,
|
||||
CombatActionHold,
|
||||
CombatActionStunt,
|
||||
CombatActionUseItem,
|
||||
CombatActionWield,
|
||||
EvAdventureCombatBaseHandler,
|
||||
)
|
||||
from .enums import ABILITY_REVERSE_MAP
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -105,10 +105,10 @@ class EvAdventureDungeonRoom(EvAdventureRoom):
|
|||
|
||||
"""
|
||||
self.tags.add("not_clear", category="dungeon_room")
|
||||
|
||||
def clear_room(self):
|
||||
self.tags.remove("not_clear", category="dungeon_room")
|
||||
|
||||
|
||||
@property
|
||||
def is_room_clear(self):
|
||||
return not bool(self.tags.get("not_clear", category="dungeon_room"))
|
||||
|
|
@ -146,9 +146,7 @@ class EvAdventureDungeonExit(DefaultExit):
|
|||
dungeon_branch = self.location.db.dungeon_branch
|
||||
if target_location == self.location:
|
||||
# destination points back to us - create a new room
|
||||
self.destination = target_location = dungeon_branch.new_room(
|
||||
self
|
||||
)
|
||||
self.destination = target_location = dungeon_branch.new_room(self)
|
||||
dungeon_branch.register_exit_traversed(self)
|
||||
|
||||
super().at_traverse(traversing_object, target_location, **kwargs)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ To get the `value` of an enum (must always be hashable, useful for Attribute loo
|
|||
----
|
||||
|
||||
"""
|
||||
|
||||
from enum import Enum
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
EvAdventure NPCs. This includes both friends and enemies, only separated by their AI.
|
||||
|
||||
"""
|
||||
|
||||
from random import choice
|
||||
|
||||
from evennia import DefaultCharacter
|
||||
|
|
@ -253,6 +254,7 @@ class EvAdventureMob(EvAdventureNPC):
|
|||
Mob (mobile) NPC; this is usually an enemy.
|
||||
|
||||
"""
|
||||
|
||||
# change this to make the mob more or less likely to perform different actions
|
||||
combat_probabilities = {
|
||||
"hold": 0.0,
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ class EvAdventureQuest:
|
|||
desc = "This is the base quest class"
|
||||
start_step = "start"
|
||||
|
||||
|
||||
# help entries for quests (could also be methods)
|
||||
help_start = "You need to start first"
|
||||
help_end = "You need to end the quest"
|
||||
|
|
@ -191,8 +190,9 @@ class EvAdventureQuest:
|
|||
|
||||
"""
|
||||
if self.status in ("abandoned", "completed", "failed"):
|
||||
help_resource = getattr(self, f"help_{self.status}",
|
||||
f"You have {self.status} this quest.")
|
||||
help_resource = getattr(
|
||||
self, f"help_{self.status}", f"You have {self.status} this quest."
|
||||
)
|
||||
else:
|
||||
help_resource = getattr(self, f"help_{self.current_step}", "No help available.")
|
||||
|
||||
|
|
@ -203,7 +203,6 @@ class EvAdventureQuest:
|
|||
# normally it's just a string
|
||||
return str(help_resource)
|
||||
|
||||
|
||||
# step methods and hooks
|
||||
|
||||
def step_start(self, *args, **kwargs):
|
||||
|
|
@ -377,6 +376,7 @@ class CmdQuests(Command):
|
|||
quest <questname>
|
||||
|
||||
"""
|
||||
|
||||
key = "quests"
|
||||
aliases = ["quest"]
|
||||
|
||||
|
|
@ -399,4 +399,3 @@ class CmdQuests(Command):
|
|||
|
||||
for quest in quests:
|
||||
self.msg(f"Quest {quest.key}: {quest.status}")
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ and determining what the outcome is.
|
|||
----
|
||||
|
||||
"""
|
||||
|
||||
from random import randint
|
||||
|
||||
from .enums import Ability
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
Test the ai module.
|
||||
|
||||
"""
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from evennia import create_object
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ Test the EvAdventure equipment handler.
|
|||
|
||||
"""
|
||||
|
||||
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from parameterized import parameterized
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ Attacks using |w{attack_type_name}|n against |w{defense_type_name}|n
|
|||
Damage roll: |w{damage_roll}|n""".strip()
|
||||
|
||||
|
||||
|
||||
def get_obj_stats(obj, owner=None):
|
||||
"""
|
||||
Get a string of stats about the object.
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ Timers are handled by persistent delays on the button. These are examples of
|
|||
such as when closing the lid and un-blinding a character.
|
||||
|
||||
"""
|
||||
|
||||
import random
|
||||
|
||||
from evennia import CmdSet, Command, DefaultObject
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
Tutorial - talking NPC tests.
|
||||
|
||||
"""
|
||||
|
||||
from evennia.commands.default.tests import BaseEvenniaCommandTest
|
||||
from evennia.utils.create import create_object
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ in a separate module (e.g. if they could have been re-used elsewhere.)
|
|||
|
||||
"""
|
||||
|
||||
|
||||
import random
|
||||
|
||||
# the system error-handling module is defined in the settings. We load the
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ the easiest place to do it. Write a method and invoke it via
|
|||
|
||||
Evennia contribution - Johnny 2017
|
||||
"""
|
||||
|
||||
import json
|
||||
import syslog
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ user inputs and system outputs.
|
|||
|
||||
Evennia contribution - Johnny 2017
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ Optional:
|
|||
object dbrefs). For boolean fields, return '0' or '1' to set
|
||||
the field to False or True.
|
||||
"""
|
||||
|
||||
import evennia
|
||||
from evennia import Command
|
||||
from evennia.utils import delay, evmenu, evtable, list_to_string, logger
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ from evennia.utils.create import create_script
|
|||
|
||||
|
||||
class RejectedRegex(RuntimeError):
|
||||
|
||||
"""The provided regular expression has been rejected.
|
||||
|
||||
More details regarding why this error occurred will be provided in
|
||||
|
|
@ -72,14 +71,12 @@ class RejectedRegex(RuntimeError):
|
|||
|
||||
|
||||
class ExhaustedGenerator(RuntimeError):
|
||||
|
||||
"""The generator hasn't any available strings to generate anymore."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class RandomStringGeneratorScript(DefaultScript):
|
||||
|
||||
"""
|
||||
The global script to hold all generators.
|
||||
|
||||
|
|
@ -99,7 +96,6 @@ class RandomStringGeneratorScript(DefaultScript):
|
|||
|
||||
|
||||
class RandomStringGenerator:
|
||||
|
||||
"""
|
||||
A generator class to generate pseudo-random strings with a rule.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue