#!/usr/bin/env python from random import random from commands.command import Command from evennia.commands.default.general import NumberedTargetCommand from utils.word_list import routput class CmdThink(Command, NumberedTargetCommand): """Think a thought out loud. Usage: think Similar to the 'say' or 'pose' commands, this communicates an inner monologue to other characters in the same area. """ key = "think" aliases = ["thinks", "("] arg_regex = None def func(self): """ Implements the think out loud command. """ if not self.args: self.caller.msg("What do you want to think out loud?") else: thought = self.args.strip() if (self.caller.db.thinking_count or 0) < 3 or random() < 0.4: msg = routput( f"""{self.caller.name} << thinks ^ wonders >> << out loud ^ aloud >> o O ( {thought} ) """ ) else: msg = f"{self.caller.name} . o O ( {thought} )" self.caller.db.thinking_count = (self.caller.db.thinking_count or 0) + 1 self.caller.location.msg_contents(msg) class CmdTake(Command, NumberedTargetCommand): """ Take an object from another character or NPC. Usage: take from Note that only some things can be stolen. For instance, the brass ring from the door knocker. """ key = "take" aliases = ["steal"] rhs_split = ("=", " from ") def func(self): """ Implements the take command. Since this command is designed to work on the object, we operate only on self.obj. """ if not self.args: self.caller.msg("What do you want to take?") elif not self.rhs: self.caller.msg(f"You want to take {self.lhs}, but from whom?") else: self.caller.do_take(self.lhs, self.rhs)