Let the guest account keep their letter

This commit is contained in:
Howard Abrams 2025-08-17 10:11:18 -07:00
parent 39493528b2
commit cef7bab8a2
2 changed files with 14 additions and 8 deletions

View file

@ -114,8 +114,9 @@ class Character(Object, GenderCharacter, ContribRPCharacter):
for tag in self.tags.all():
self.tags.remove(tag)
# Remove everything in their inventory...including letter/ticket
# Remove everything in their inventory...excluding the letter:
for obj in self.contents:
if obj.name != "letter":
logger.warning(f"Guest account: deleting {obj.name}")
obj.delete()
@ -155,7 +156,7 @@ class Character(Object, GenderCharacter, ContribRPCharacter):
"""
Return string containing location information from IP address.
"""
ip_address = self.account.sessions.get()[0].address
ip_address = self.sessions.get()[0].address
if ip_address == "127.0.0.1":
return "(from localhost)"
@ -282,11 +283,16 @@ class Character(Object, GenderCharacter, ContribRPCharacter):
This replaces the weird, auto-generated name with the
character's actual name.
"""
# letter = search_object('letter', location=self).first()
letter = self.search('letter', quiet=True)
letter = self.search('letter', location=self, quiet=True)
if letter:
letter = letter[0]
text = sub(r"My dear [^,]*", f"My dear {self.name}", letter.db.inside)
if self.db.guest_account:
text = sub(r"My dear[^,]*", "My dearest friend",
letter.db.inside)
else:
text = sub(r"My dear[^,]*", f"My dear {self.name}",
letter.db.inside)
letter.db.inside = text
def create_ticket(self):

View file

@ -163,7 +163,7 @@ class TutorBird(CarriableNPC):
"typeclass": "typeclasses.tutorial.TutorBird",
"key": "bird",
"aliases": ["cockatiel", "tutor", "tutor bird"],
"desc": "You see a tiny bird with gray feathers trimmed with white. It's large black eyes looks at you quizically. Its yellow cheeks are adorable, as it seems overly helpful.",
"desc": "Gray feathered bird perched on your shoulder. It's large black eyes looks at you quizically. Its yellow cheeks are adorable, making it seem overly helpful.",
})[0]
bird.location = character