def emoteTo(actor, target, first, second, third): if target.room not in [actor.room, actor.inventory]: unfoundObject() return first = process(first) second = process(second) third = process(third) actor.receiveEvent(EmoteTargettedFirst(target, first)) target.receiveEvent(EmoteTargettedSecond(actor, second)) distributeEvent(actor.room, [actor, target], EmoteTargettedThird(actor, target, third))
def emoteToWrapper(actor, text, info): try: blob, text = emote_to_pattern.parseString(text) except ParseException: badSyntax() return try: target = get_from_rooms(blob, [actor.inventory, actor.room], info) except UnfoundError: unfoundObject() return text = text.replace('%', '%%') emoteTo(actor, target, 'You have emoted: ' + text, text, text)