[wpdev-commits] xmlscripts/scripts/commands kickban.py,NONE,1.1 remove.py,1.2,1.3
Brought to you by:
rip,
thiagocorrea
From: Richard M. <dr...@us...> - 2004-09-09 02:31:22
|
Update of /cvsroot/wpdev/xmlscripts/scripts/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6709/scripts/commands Modified Files: remove.py Added Files: kickban.py Log Message: Made it where remove cannot delete staff characters. Remove gives a warning about removing players. Started the kick/ban commands, not finished yet. Removed definitions.xml, we use definitions/index.xml now anyways. --- NEW FILE: kickban.py --- """ \command kick \description Kicks a connected client by target or account name. """ """ \command ban \description Kick-bans an account by target or account name. """ import wolfpack from wolfpack.consts import LOG_MESSAGE def onLoad(): wolfpack.registercommand( "kick", commandKick ) wolfpack.registercommand( "ban", commandBan ) def commandKick( socket, cmd, args ): if len( args ) > 0: accname = args.lower() account = None account = wolfpack.accounts.find( accname ) accountAction( socket, account, 'kick' ) return else: socket.sysmessage( "Please select the object for removal." ) socket.attachtarget( "commands.remove.doKick", [] ) return True def commandBan( socket, cmd, args ): if len( args ) > 0: accname = args.lower() account = None account = wolfpack.accounts.find( accname ) accountAction( socket, account, 'ban' ) return else: socket.sysmessage( "Please select the object for removal." ) socket.attachtarget( "commands.remove.doBan", [] ) return False def accountAction( socket, account, action ): if account == None: socket.sysmessage( "Failed to find an account with the given name." ) return False elif account and account.acl == 'player': if action == 'kick': account.block() for char in account.characters: if char.socket: char.soscket.sysmessage( "You've been kicked from the shard by the staff." ) char.socket.disconnect() socket.sysmessage( "You have disconnected %s." % char.name ) return True elif action == 'ban': account.block() for char in account.characters: if char.socket: char.soscket.sysmessage( "You've been kick-banned from the shard by the staff." ) char.socket.disconnect() socket.sysmessage( "You have kick-banned %s." % char.name ) return True return False Index: remove.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/commands/remove.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** remove.py 14 Jul 2004 07:17:38 -0000 1.2 --- remove.py 9 Sep 2004 02:31:09 -0000 1.3 *************** *** 12,15 **** --- 12,16 ---- def commandRemove(socket, cmd, args): socket.sysmessage( "Please select the object for removal." ) + socket.sysmessage( "Caution: This can remove players!" ) socket.attachtarget( "commands.remove.doRemove", [] ) return True *************** *** 37,40 **** --- 38,44 ---- return False else: + if player.account.acl != 'player': + char.socket.sysmessage( "Players with special accounts can not be removed." ) + return False if socket: socket.disconnect() |