def _send_quiet_roll_msg(self): """ Notifies all staff and specified player(s) in the room of the result of the roll. """ namelist = [] roll_msg = "|w[Private Roll]|n " + Roll.build_msg( self.caller.ndb.last_roll) if self.rhs.lower() in ( "me", "self", str(self.caller).lower(), str(self.caller.key).lower(), ): namelist.append("self-only") else: # send roll message to each recipient for name in self.rhs.split(","): recipient = self.caller.search(name.strip(), use_nicks=True) if recipient: namelist.append(name.strip()) recipient.msg(roll_msg, options={"roll": True}) roll_msg += " (Shared with: %s)" % ", ".join(namelist) self.caller.msg(roll_msg, options={"roll": True}) # GMs always get to see rolls. staff_list = [ x for x in self.caller.location.contents if x.check_permstring("Builders") ] for gm in staff_list: gm.msg(roll_msg, options={"roll": True})
def func(self): """Run the @check command""" caller = self.caller skill = None maximum_difference = 100 flub = "flub" in self.switches if not self.args: caller.msg("Usage: @check <stat>[+<skill>][ at <difficulty number>][=receiver1,receiver2,etc]") return args = self.lhs if self.rhs else self.args args = args.lower() # if args contains ' at ', then we split into halves. otherwise, it's default of 6 diff_list = args.split(' at ') difficulty = stats_and_skills.DIFF_DEFAULT if len(diff_list) > 1: if not diff_list[1].isdigit() or not 0 < int(diff_list[1]) < maximum_difference: caller.msg("Difficulty must be a number between 1 and %s." % maximum_difference) return difficulty = int(diff_list[1]) args = diff_list[0] arg_list = args.split("+") if len(arg_list) > 1: skill = arg_list[1].strip() stat = arg_list[0].strip() matches = stats_and_skills.get_partial_match(stat, "stat") if not matches or len(matches) > 1: caller.msg("There must be one unique match for a character stat. Please check spelling and try again.") return # get unique string that matches stat stat = matches[0] if skill: matches = stats_and_skills.get_partial_match(skill, "skill") if not matches: # check for a skill not in the normal valid list if skill in caller.db.skills: matches = [skill] else: caller.msg("No matches for a skill by that name. Check spelling and try again.") return if len(matches) > 1: caller.msg("There must be one unique match for a character skill. Please check spelling and try again.") return skill = matches[0] quiet = bool(self.rhs) stats_and_skills.do_dice_check(caller, stat, skill, difficulty, quiet=quiet, flub=flub) if quiet: namelist = [name.strip() for name in self.rhs.split(",") if caller.search(name.strip(), use_nicks=True)] roll_msg = Roll.build_msg(caller.ndb.last_roll) + " " + "(Private roll sent to: %s)" % ", ".join(namelist) caller.msg(roll_msg) # they have a recipient list; only tell those people (and GMs) for name in namelist: recipient = caller.search(name, use_nicks=True) recipient.msg(roll_msg, options={'roll':True}) # GMs always get to see rolls. staff_list = [x for x in caller.location.contents if x.check_permstring("Builders")] for GM in staff_list: GM.msg("{w(Private roll) {n" + roll_msg) return