Пример #1
0
 def func(self):
     character = self.character
     if not self.args:
         self.msg('{R[Please specify a character.  See {rhelp %s{R for details]' % (self.key))
         return
     target = match_character(self.args, exact=True)
     if not target:
         self.msg('{R[That character could not be found]')
         return
     if not target.location or not target.location.access(character, 'kick_occupant'):
         return # Access failure should have sent a message
     # Determine the region
     region = target.get_region()
     if not region and target.home:
         region = target.home.get_region()
     if not region:
         default_home = ObjectDB.objects.get_id(settings.CHARACTER_DEFAULT_HOME)
         region = default_home.get_region()
     if not region:
         raise Exception('could not find region')
     # All is well.  Do the kickin'
     target.location.msg_contents("{Y[%s has been kicked from the area by %s]" % (target.key, character.key), exclude=[target, character])
     character.msg('{Y[%s has been kicked from "%s"]' % (target.key, target.location.key))
     target.msg('{Y[You have been kicked from this area by %s]' % (character.key))
     target.move_to(region, redirectable=True, followers=False)
Пример #2
0
 def cmd_optout(self, targetname):
     if targetname[:1] == '!':
         optout = False
         target = match_character(targetname[1:], exact=True)
     else:
         optout = True
         target = match_character(targetname, exact=True)
     if not target:
         self.msg('{R[Player not found]')
         return
     if target.get_owner() != self.player:
         self.msg('{R["%s" is not one of your characters]' % (target.key))
         return
     target.db.friends_optout = optout
     if optout:
         self.msg('{G["%s" is now invisible to the friend system.]' % (target.key))
     else:
         self.msg('{G["%s" has opted back into the friend system.]' % (target.key))
Пример #3
0
 def cmd_whereis(self, targetname):
     friend = match_character(targetname, exact=False)
     if not friend:
         self.msg('{R[Character not found]')
         return
     if not friend in self.player.get_friend_characters(online_only=False):
         self.msg('{R%s is not on your friend list.' % (friend.key))
         return
     friend_location = friend.location
     if not friend_location:
         self.msg("Your friend doesn't appear to be anywhere in particular.")
     else:
         friend_map = friend.get_desc_map()
         if friend_map:
             self.msg(friend_map)
         self.msg('%s is %s.' % (friend.key, ", ".join([inside.objsub('&0w') for inside in friend_location.trace()])))
Пример #4
0
 def cmd_ic(self):
     player = self.player
     characters = player.get_characters()
     # Determine which character to occupy
     if self.args:
         target = match_character(self.args)
         if not target or not target in characters:
             self.msg("{R[That's not a valid character selection]")
             return
     else:
         target = player.last_puppet()
         if not target or not target in characters:
             self.msg("{R[Please specify a character.  See {r%s/list{R for a list]" % (self.key))
             return
     # Puppet the character (and output success/failure messages)
     player.do_puppet(self.sessid, target)
     player.at_display_context(self.sessid)
Пример #5
0
 def cmd_del(self):
     player = self.player
     characters = player.get_characters()
     # Find the character to nuke
     target = match_character(self.lhs)
     if not target:
         self.msg("{R[That's not a valid character selection]")
         return
     # Ensure you have permissions
     if not player.check_password(self.rhs):
         self.msg("{R[Password incorrect]")
         return
     if not target.access(player, 'char_delete'):
         self.msg("{R[You're not allowed to delete that character]")
         if target in characters:
             self.msg('{R[If you believe this is an error, please contact {[email protected]{R]')
         return
     # Bye bye character
     target_player = target.player
     target_sessid = target.sessid
     # Bye bye character step 1: Unpuppet any player that's currently puppeted
     if target_player:
         target_player.do_unpuppet(target_sessid)
     # Bye bye character step 2: Send the character into the abyss and alert nearby objects
     if target.location:
         target.location.msg_contents('%s disappears.' % (target.key), exclude=[target])
     target.location = None
     target.set_owner(None)
     # Bye bye character step 3: Finalize the deletion, and alert the player(s) involved.
     target_name = target.key
     #target.delete()
     alertus = {player}
     if target_player:
         alertus.add(target_player)
     for alertme in alertus:
         alertme.msg('{R[The character "%s" has been deleted by {c%s{r]' % (target_name, player.get_desc_styled_name(alertme)))