Fix bug when rooms try to give coins

This commit is contained in:
Howard Abrams 2025-08-16 23:41:27 -07:00
parent 13991e0a03
commit 218a21a7a2

View file

@ -506,6 +506,24 @@ class Listener:
o.move_to(d, quiet=True) o.move_to(d, quiet=True)
return return
# Private message only a single character can hear:
m = match(r"gmm +(.*?) *= *(.*)", cmd)
if m:
obj = search_object(m.group(1)).first()
msg = m.group(2)
if obj and msg:
obj.msg(msg)
return
# Character announce_action message:
m = match(r"gma +(.*?) *= *(.*)", cmd)
if m:
obj = search_object(m.group(1)).first()
msg = m.group(2)
if obj and msg:
obj.announce_action(msg)
return
m = match(r"tag_all +(.*) *", cmd) m = match(r"tag_all +(.*) *", cmd)
if m: if m:
tag = m.group(1) tag = m.group(1)
@ -532,14 +550,16 @@ class Listener:
m = match(r"coin_all ([0-9]+)", cmd) m = match(r"coin_all ([0-9]+)", cmd)
if m: if m:
for c in self.characters_here(puppets=True): for c in self.characters_here(puppets=True):
c.adjust_coins(m.group(1)) coins = int(m.group(1))
logger.info(f"Giving {c.key} {coins} coins.")
c.adjust_coins(coins)
return return
m = match(r"coin ([0-9]+) *?( to|=)? *([^:]+)", cmd) m = match(r"coin ([0-9]+) *?( to|=)? *([^:]+)", cmd)
if m: if m:
c = self.search(m.group(3)) c = self.search(m.group(3))
if c: if c:
c.adjust_coins(m.group(1)) c.adjust_coins(int(m.group(1)))
return return
if self.is_typeclass("typeclasses.characters.Character"): if self.is_typeclass("typeclasses.characters.Character"):