Fix a small bug when displaying names

This commit is contained in:
Howard Abrams 2025-06-21 10:57:21 -07:00
parent e654a46137
commit c147594489
3 changed files with 12 additions and 6 deletions

View file

@ -91,9 +91,10 @@ class Character(Object, GenderCharacter, ContribRPCharacter):
else:
self.db.visited = True
self.db.tutorstate = 0
self.fix_letter()
TutorBird.do_start_tutorial(self)
self.msg(INTRO)
self.fix_letter()
self.account.db._last_puppet = self
def at_pre_unpuppet(self, **kwargs):
@ -180,6 +181,12 @@ class Character(Object, GenderCharacter, ContribRPCharacter):
letter.location = self
def fix_letter(self):
"""
Adjust the letter initially created for the character.
This replaces the weird, auto-generated name with the
character's actual name.
"""
letter = self.search('letter', location=self)
if letter:
text = sub(r"My dear [^,]*", f"My dear {self.name}", letter.db.inside)

View file

@ -31,9 +31,9 @@ def articlize_character(character, capitalize=False):
else:
article = "a"
if character == "" or match(r"^\|b[A-Z]", character):
if character == "" or match(r"^\|[bm][A-Z]", character):
return character
elif match(r"^\|b*[aeiou]", character):
elif match(r"^\|[bm][aeiou]", character):
return f"{article}n " + character
else:
return f"{article} " + character

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python
from random import choice, random, randint
from re import match, IGNORECASE
from enum import Enum
from evennia import create_script
@ -19,8 +20,6 @@ from utils.word_list import routput, choices
from .scripts import KnockScript
from .objects import Object
import re
class CoinPurse(Object):
"""
@ -525,7 +524,7 @@ class Knocker(Object):
for [regex, convo_state, responses, new_state] in self.all_responses:
full_regex = r".*" + regex + r".*"
if re.match(full_regex, message, re.IGNORECASE) \
if match(full_regex, message, IGNORECASE) \
and curr_state.value >= convo_state.value:
# logger.info(f"Spoke: {message}, matched: {full_regex} and {curr_state} >= {convo_state}")