Added a check to avoid creating a duplicate character name with charcreate in MULTISESSION_MODE>1. Resolves 943.
This commit is contained in:
parent
8844b7bb80
commit
37a24f12e6
1 changed files with 10 additions and 2 deletions
|
|
@ -136,14 +136,22 @@ class CmdCharCreate(MuxPlayerCommand):
|
||||||
len(player.db._playable_characters) >= charmax):
|
len(player.db._playable_characters) >= charmax):
|
||||||
self.msg("You may only create a maximum of %i characters." % charmax)
|
self.msg("You may only create a maximum of %i characters." % charmax)
|
||||||
return
|
return
|
||||||
# create the character
|
|
||||||
from evennia.objects.models import ObjectDB
|
from evennia.objects.models import ObjectDB
|
||||||
|
typeclass = settings.BASE_CHARACTER_TYPECLASS
|
||||||
|
|
||||||
|
if ObjectDB.objects.filter(db_typeclass_path=typeclass, db_key__iexact=key):
|
||||||
|
# check if this Character already exists. Note that we are only
|
||||||
|
# searching the base character typeclass here, not any child
|
||||||
|
# classes.
|
||||||
|
self.msg("{rA character named '{w%s{r' already exists.{n" % key)
|
||||||
|
return
|
||||||
|
|
||||||
|
# create the character
|
||||||
start_location = ObjectDB.objects.get_id(settings.START_LOCATION)
|
start_location = ObjectDB.objects.get_id(settings.START_LOCATION)
|
||||||
default_home = ObjectDB.objects.get_id(settings.DEFAULT_HOME)
|
default_home = ObjectDB.objects.get_id(settings.DEFAULT_HOME)
|
||||||
typeclass = settings.BASE_CHARACTER_TYPECLASS
|
|
||||||
permissions = settings.PERMISSION_PLAYER_DEFAULT
|
permissions = settings.PERMISSION_PLAYER_DEFAULT
|
||||||
|
|
||||||
|
|
||||||
new_character = create.create_object(typeclass, key=key,
|
new_character = create.create_object(typeclass, key=key,
|
||||||
location=start_location,
|
location=start_location,
|
||||||
home=default_home,
|
home=default_home,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue